-
Notifications
You must be signed in to change notification settings - Fork 418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A11y popup menu #874
A11y popup menu #874
Conversation
Ensures we don't capture a canvas click via the backdrop, but instead register click outside as an external (global) handler. chore(popup-menu): remove backdrop * Drop backdrop * Move exit and focus handling to PopupMenuWrapper
To be considered: Do not browser focus existing element, but only do so on tab navigation: |
Ensure we do not react to `SPACE` and `ENTER` on buttons to shadow stock keyboard interaction / block browser default behavior.
Add a marginal margin to ensure outline is properly displayed.
Updated with latest screenshots, preventing outline cut off via a574bf0. Now ready for review. |
It looks good on Chrome, but there are some problems on Safari: Screen.Recording.2024-03-22.at.09.18.56.mov
|
This is Safari 17.0 |
So we have to decide if we invent a completely new outline, standardized across all browsers. I'd keep that as a follow-up activity. |
I'm OK with outline cut-off but it would be great if the focus worked correctly. I will check in the dev tools what is happening there. |
So via TAB I cannot reach the header modules, and after I TAB out, it focusses the body. |
tabIndex="0" | ||
onClick=${ onAction } | ||
onFocus=${ onMouseEnter } | ||
onBlur=${ onMouseLeave } | ||
onMouseEnter=${ onMouseEnter } | ||
onMouseLeave=${ onMouseLeave } | ||
onDragStart=${ (event) => onAction(event, entry, 'dragstart') } | ||
aria-role="button" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the items serve as buttons now, why don't we make them actual buttons? Spans make sense if we want to keep the select-option-like behavior but we decided against this as I understand.
|
||
const inputEl = popupEl.querySelector('input'); | ||
|
||
(inputEl || popupEl).focus(); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
autofocus
is unfortunately regarded as an anti-pattern.
OK it might be that I don't know my tool. I can tab to the header buttons via Option+TAB: https://stackoverflow.com/questions/1848390/safari-ignoring-tabindex |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Firefox
Chrome
This PR improves the accessibility of the popup menu:
SPACE
andENTER
can be used as expected to toggle featuresAdditional notes:
Can be tried out using the following command on your local machine:
Closes #871