-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Description
WAI-ARIA suggests returning focus to the previously focused element when closing a modal dialog, with an example:
When a dialog closes, focus returns to the element that invoked the dialog unless either:
Using focus-visible here is tricky as currently the polyfill responds to all keydown events and adds .focus-visible
class when the ARIA refocusing happens by tapping Escape key to close a dialog.
Maybe we can exclude Escape key from onKeyDown
, what do you think?
focus-visible/src/focus-visible.js
Lines 102 to 108 in 1756d66
function onKeyDown(e) { | |
if (isValidFocusTarget(document.activeElement)) { | |
addFocusVisibleClass(document.activeElement); | |
} | |
hadKeyboardEvent = true; | |
} |
Metadata
Metadata
Assignees
Labels
No labels