fix(a11y): Escape no longer yanks focus into the composer (#187 DP9)
CI / Build & Quality Checks (push) Successful in 6m18s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 10s
CI / Trigger Desktop Build (push) Successful in 10s
CI / Playwright smoke (e2e) (push) Canceled after 14m59s
CI / Build & Quality Checks (push) Successful in 6m18s
CI / Docker image build & smoke test (push) Skipped
CI / Secret scan (gitleaks) (push) Successful in 10s
CI / Trigger Desktop Build (push) Successful in 10s
CI / Playwright smoke (e2e) (push) Canceled after 14m59s
RoomView focuses the composer on any "typing" key pressed while nothing editable has focus, and Escape counted as typing. Closing the GIF picker with Esc (its focus trap returns focus to the GIF button) therefore landed in the composer instead, and so did Esc on any other room control. Escape, CapsLock, Insert, ContextMenu, PrintScreen and Pause are now excluded like the other non-typing keys. Verified at 1300 px and 320 px: Esc closes the picker and focus is back on "Insert GIF"; the 320 px picker fits with no page overflow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PPmy3tPq869XDW4njjVaKA
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
f3722ae859
commit
e06600afe1
@@ -51,7 +51,17 @@ const shouldFocusMessageField = (evt: KeyboardEvent): boolean => {
|
||||
code === 'Space' ||
|
||||
code === 'Enter' ||
|
||||
code === 'NumLock' ||
|
||||
code === 'ScrollLock'
|
||||
code === 'ScrollLock' ||
|
||||
// Not typing: Escape in particular dismisses popouts, and a focus-trap
|
||||
// hands focus back to the opener on Escape. Treating it as "start typing"
|
||||
// yanked focus into the composer instead (#187 DP9: closing the GIF picker
|
||||
// with Esc left focus in the composer, not on the GIF button).
|
||||
code === 'Escape' ||
|
||||
code === 'CapsLock' ||
|
||||
code === 'Insert' ||
|
||||
code === 'ContextMenu' ||
|
||||
code === 'PrintScreen' ||
|
||||
code === 'Pause'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user