Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,7 @@
## 2024-08-04 - 숫자 입력 필드 빈 문자열 상태 초기화 처리
**학습:** 숫자 입력 필드에서 빈 문자열('')을 입력할 때 브라우저는 이전의 유효하지 않은 상태를 암시적으로 유지하므로, 사용자 정의 검증을 명시적으로 초기화하지 않으면 네이티브 HTML5 유효성 검사가 정상 작동하지 않을 수 있음을 확인했습니다.
**실행:** 인라인 검증 스크립트 작성 시 빈 문자열 상태를 별도로 확인하여 this.setCustomValidity('') 및 this.removeAttribute('aria-invalid')를 명시적으로 호출하는 로직을 추가해야 합니다.

## 2024-09-04 - Improve ARIA state logic on preset buttons
**Learning:** Checking `!e.isTrusted` inside an `input` event listener when an external button click manually dispatches the event (`dispatchEvent`) is unreliable across browsers or testing frameworks, as manual dispatch might not reset `isTrusted` in the way expected, or we might miss normal user typing events properly updating `aria-pressed`. It's better to simply sync the `aria-pressed` state directly without relying on `!e.isTrusted`, ensuring it's always correct whether the change came from typing or clicking.
**Action:** When synchronizing state between an input field and a group of buttons, always rely on the actual value of the input to determine the `aria-pressed` state, rather than trying to detect the source of the event via `e.isTrusted`.
4 changes: 2 additions & 2 deletions saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ async def add_security_headers(request: Request, call_next):
const presetValue = Number.parseInt(btn.dataset.bytes, 10);
btn.setAttribute(
'aria-pressed',
!e.isTrusted && presetValue === val ? 'true' : 'false'
presetValue === val ? 'true' : 'false'
);
});

Expand Down Expand Up @@ -286,7 +286,7 @@ async def add_security_headers(request: Request, call_next):
const presetValue = Number.parseInt(btn.dataset.bytes, 10);
btn.setAttribute(
'aria-pressed',
!e.isTrusted && presetValue === val ? 'true' : 'false'
presetValue === val ? 'true' : 'false'
);
});

Expand Down
2 changes: 1 addition & 1 deletion tests/test_saas_web.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def test_get_ui_includes_preset_buttons(self):
self.assertIn(
"const presetValue = Number.parseInt(btn.dataset.bytes, 10);", html
)
self.assertIn("!e.isTrusted && presetValue === val", html)
self.assertIn("presetValue === val", html)
self.assertNotIn("btn.dataset.bytes === this.value", html)


Expand Down
Loading