-
-
Notifications
You must be signed in to change notification settings - Fork 32.8k
[Snackbar] Add F6 keyboard shortcut for accessibility #47458
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
base: master
Are you sure you want to change the base?
[Snackbar] Add F6 keyboard shortcut for accessibility #47458
Conversation
Netlify deploy previewBundle size report
|
|
@siriwatknp Do you think we should support this in Material UI like in Base UI Toast? |
Unlike Base UI, the Material UI snackbar is already part of the tab sequence – if you open the first snackbar with keyboard, the next 2 tab stops become the So IMO the hotkey only makes sense if the popup contents are otherwise inaccessible via keyboard |
So, is this issue not relevant: #45243? Don't remember why I had commented that we can add support for F6. |
|
@ZeeshanTamboli Maybe it's still worth adding depending on the "dynamic snackbar" case mentioned in the original issue, do you have any idea what that is?
The hotkey would be great if this behavior didn't already exist, technically it may be breaking to change it? Or we could consider it a bug and never intended to begin with |
I wonder "dynamic snackbar" would be when it is controlled by state or events. But I don't see even then how the tab focusing wouldn't work for the issue author.
We can't change it. It would be a breaking change. |
|
We could add the hotkey, then open an issue for future removal of the Snackbar being part of the tab sequence ever; having both isn't the end of the world, but the hotkey would be the correct (and documented) way of moving keyboard focus to the snackbar |
But since the advent of Snackbar, we haven't seen issues about not being able to focus it or its contents, which suggests people are relying on normal Tab navigation. Given that, IMO, adding a hotkey besides supporting Tab navigation doesn't seem worth adding it right now, especially since it would increase bundle size. I think the best next step is to wait for the issue author to clarify their use case. |
Description
This PR improves the keyboard accessibility of the Snackbar component by adding an F6 keyboard shortcut that moves focus directly to the Snackbar when it is open. This makes it easier for keyboard users to access dynamic snackbars and their interactive elements (such as the close button or links) without having to tab through the entire page.
Changes
keydownlistener when the Snackbar is open and handle the F6 key.tabIndex={0}.role="status"for assistive technologies.docs/data/material/components/snackbars/snackbars.md) to document:role="status"is applied to the Snackbar.tabIndex="0"is applied so the Snackbar is focusable.Related issue
Fixes #45243
Additional