Skip to content

A11y Bug 6210968: Keyboard focus gets lost after closing the 'location dropdown' control via esc key.#643

Open
KethanaReddy7 wants to merge 3 commits intouser/kpeddireddy/LocationButtonTabfrom
claude/issue-641-20260312-1033
Open

A11y Bug 6210968: Keyboard focus gets lost after closing the 'location dropdown' control via esc key.#643
KethanaReddy7 wants to merge 3 commits intouser/kpeddireddy/LocationButtonTabfrom
claude/issue-641-20260312-1033

Conversation

@KethanaReddy7
Copy link

@KethanaReddy7 KethanaReddy7 commented Mar 17, 2026

When the location dropdown was closed via the Escape key, keyboard focus was lost, making it difficult for keyboard-only users to continue navigating. This fix ensures focus returns to the dropdown trigger element when the popup closes, improving accessibility for keyboard users.

Demo
https://github.com/user-attachments/assets/ac836069-451d-4d8d-a1c5-cd2de19b05b9

Fixes #641

…cape key

When the location dropdown was closed via the Escape key, keyboard focus was
lost, making it difficult for keyboard-only users to continue navigating.
This fix ensures focus returns to the dropdown trigger element when the popup
closes, improving accessibility for keyboard users.

Fixes #641

Co-authored-by: KethanaReddy7 <KethanaReddy7@users.noreply.github.com>
@KethanaReddy7
Copy link
Author

@claude on entering escape from the dropdown list the focus is escaping somewhere but it should land on location dropdown as shown in image
image

@claude
Copy link

claude bot commented Mar 18, 2026

Claude finished @KethanaReddy7's task in 3m 14s —— View job


Fixed Focus Issue

  • Investigate current focus handling implementation
  • Identify why focus is escaping instead of landing on location dropdown
  • Implement fix for proper focus restoration
  • Commit the fix

Root Cause: The focus was being set immediately during the onPopupToggle callback, but the OneNotePicker component's internal DOM manipulation was happening after the focus call, causing the focus to be lost.

Fix: Wrapped the focus call in setTimeout(() => {...}, 0) to defer focus until after the DOM has stabilized following the popup closure. This is a common pattern for focus management in dynamic UIs where DOM changes may occur asynchronously.

Changes:

  • src/scripts/clipperUI/components/sectionPicker.tsx - Deferred the focus call using setTimeout
  • src/tests/clipperUI/components/sectionPicker_tests.tsx - Updated test to handle async focus behavior
    |

github-actions bot and others added 2 commits March 18, 2026 04:30
The focus was being lost because it was set immediately during the
onPopupToggle callback, but the OneNotePicker component's internal
DOM manipulation was happening after the focus call. By using
setTimeout(0), the focus is now deferred until after the event loop
allows the DOM to stabilize.

Co-authored-by: KethanaReddy7 <KethanaReddy7@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant