-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Fix/keyboard shortcut modal scrolling #45759
base: trunk
Are you sure you want to change the base?
Fix/keyboard shortcut modal scrolling #45759
Conversation
|
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @tohmjudson! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
@tohmjudson Thanks for the PR! Could you please resolve the conflicts? Thanks. |
9b0c4c5
to
fdbdae5
Compare
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.
@tohmjudson Some further thoughts. Please note, this is a fairly difficult issue to solve considering the accessibility issues involved. If you can't solve the A11Y part of this, I can try to help.
@@ -198,7 +198,13 @@ function UnforwardedModal( | |||
) } | |||
</div> | |||
) } | |||
{ children } | |||
<div |
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.
Hmm, let's not modify the Modal component. The problem only exists in the keyboard shortcuts modal, these changes are not needed globally, right?
<div | ||
className="components-modal__container" | ||
tabIndex={ 0 } | ||
role="region" |
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.
This region is not going to work here I do not think.
https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/dialog_role
Does not look like this would really be a valid approach. I wonder what would happen without the role here? Might be worth a try. If we introduce this ARIA here, we'll have to introduce it elsewhere. E.g. Using role="banner"
, role="main"
, role="contentinfo"
. Having one region like this in my opinion would be too confusing.
What?
Fixes #41500
Why?
Users are unable to scroll inside the keyboard shortcut modal
How?
Adds a container with tabindex to the modal content to allow focus on content div to allow scrolling.
Testing Instructions
Note: This may need an aria-label for the new region. It does not seem to be required to pass or function, but would be helpful to have a non-empty tab stop for screenreader users. I am unsure of how that would work with internationalization so I have not added it yet. This would be inserted at line 204 in packages/components/src/modal/index.tsx
References
https://www.tpgi.com/short-note-on-improving-usability-of-scrollable-regions/
https://dequeuniversity.com/rules/axe/3.5/scrollable-region-focusable
https://accessibilityinsights.io/info-examples/web/scrollable-region-focusable/
Tested:
Safari: Version 16.0 (17614.1.25.9.10, 17614)
Firefox: Version 106.0.5
Chrome: Version 107.0.5304.110