-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Improve the Scrollable component accessibility #45809
Comments
One more thing: if the Scrollable element is made focusable, there will be the need to check if and how that may impact the |
This is a great plan and definitely needed. I agree with your statement about the |
#47426 is going to introduce some of the logic needed for an accessible scrollable to fix bugs within the Modal component. That logic should be better abstracted here for the Scrollable component. As suggested in #47426 (comment) a hook would probably be the best approach. Also, it would be great to have #41001 in place to see if the accessible Scrollable can use the |
Description
Browsers have different native behaviors when it comes to elements made scrollable with CSS overflow:
For keyboard users, it is essential to be able to scroll a scrollable element to see all its content. When the element contains focusable elements, more or less users are able to make the element scroll by tabbing through the focusable elements. However, when the scrollable element does not contain focusable elements, there's no way for keyboard users to scroll. See for example the Keyboard shortcuts modal: #41500
As said above, the underlying issue comes from different browsers behavior. Regardless, we should make sure keyboard users can always access the content of a Scrollable component.
There's a simple technique to remediate see this note by the Paciello group:
Short note on improving usability of scrollable regions
https://www.tpgi.com/short-note-on-improving-usability-of-scrollable-regions/
tabindex=0
to include the scrollable element in the tab sequence for all browsers.The Paciello group recommends to use
role=region
and anaria-label
with a meaningful value. That seems fine to me, with a little drawback: an element withrole=region
and anaria-label
becomes an ARIA landmark. As such, it will be listed by screen readers in the page landmarks. Ideally, landmarks should be used only to mark the main regions of a page. This seems a minor annoyance compared to the greater benefit users will get from being able to scroll.By fixing the accessibility of the Scrollable component, we could also consider to re-use it in more places to fix issues like #41500.
Worth also mentioning the technique to make scrollable elements accessible is already used in Core, see for example https://core.trac.wordpress.org/ticket/49211
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: