-
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
Interactivity API: aria-modal is not sufficient to hide content from assistive technology #61944
Comments
Noting that the Navigation block, when set to open in an overlay, works differently from the Image block lightbox. The lightbox modal dialog markup is a first children of the body, which makes easy to hide all the other children with aria-hidden=true. Instead, the navigation block modal dialog markup is nested within the content of the page. This isn't ideal. It would be way better if it was rendered as a first child of the body. |
@afercia, as this seems to pertain to implementations of the Navigation block and the Image block, and not a direct bug of the Interactivity API, I’m going to change the labels. But feel free to respond if you think this is incorrect. |
@luisherranz I have no strong opinions but I'd tend to think that if |
What do you suggest? |
I would expect this to work out of the box for developers using the API. A bind data attribute like this: |
What I mean is, could you describe what you think the Interactivity API should do when encountering a directive |
I tried to describe it in #61944 (comment) When the element with Worth noting in #61313 (comment) I suggested to abstract these functions and logic to a generic component that can be used for other components as well because the 'modal' behavior isn't exclusive to modal dialogs. Instead, when the element with |
Ok, I understand, now. Thank you 🙂 Should we first manually fix the problem on the Image and Navigation blocks and then think about which abstraction we could build on top of the Interactivity API so that this is done automatically? |
It would be great to at least fix the modal 🙂 Not sure what to do with the navigation. |
Are there already any issues for these two problems with the Image Block and the Navigation Block? If not, could you open them? |
Description
DIscovered while reviewing #61313
The
aria-modal
attribute is supposed to hide from assistive technology the rest of the page outside of a 'modal' element. A modal element can be, but not limited to, a dialog.That is: an element with
role-dialog and aria-modal=true
.Unfortunately, aria-modal is not fully supported by Safari and VoiceOver. This was first noted on May 2018 when implementing the Modal component. That's the reason why the Modal component doesn't use
aria-modal
. Instead, it uses a small helper to hide the rest of the page by setting aria-hidden=true on all the first children of the body except the modal dialog itself (and except live regions and script elements).The Interactivity API does use
aria-modal
for the navigation and the image block. Unfortunately, that fails with Safari and VoiceOver. This was probably missed when implementing the modal dialogs for navigation and image but shoudl be remediated with an approach similar to the one used for the Modal component.It would be great if
aria-modal
worked as expected but unfortunately it doesn't. Until support improves, WordPress should make sure content outside of any modal dialog is effectively hidden from assistive technologies.Also, I'd think that having a consistent implementation (in terms of actual behaviro and interaction, not code) between back end and front end is important.
Step-by-step reproduction instructions
Compare the behavior of a
Modal
component in the editor with the one of the Image 'Expand on click` feature.Use Safari and VoiceOver.
Modal component:
This proves all the content outside of the modal dialog is effectively hidden from VoiceOver.
Test the Image 'Click to expand' modal dialog.
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: