-
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
Only add dialog role to navigation when modal is open. #37434
Conversation
Size Change: +25 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
return ( | ||
<> | ||
{ ! isOpen && ( | ||
<Button | ||
aria-haspopup="true" | ||
aria-expanded={ isOpen } |
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.
Thank you for removing the aria-expanded
attribute here, since changing the button label is enough to convey the status the modal is currently in and what will happen when the button is activated. 👍
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 is working very well for me, thanks so much for working on this. It's less code, it's clearer, and as best I can tell it's working as intended: when collapsed, it's not a dialog
:
When the modal is opened, it's a dialog
:
Giving a green check here based on my best ability, but I would appreciate if we could boost the confidence with testing by folks more skilled in the area. Thank you!
'aria-label': __( 'Menu' ), | ||
} ), | ||
}; | ||
|
||
return ( | ||
<> | ||
{ ! isOpen && ( | ||
<Button | ||
aria-haspopup="true" |
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.
It's definitely a dialog, so I don't know whether it should be aria-haspop="dialog"
. It is a menu in a dialog, so maybe that makes it ok to use true. 🤔
Could you add testing instructions to the PR? I'm not really sure what I'm supposed to be testing. The issue isn't very clear, either as it's very long with multiple sets of instructions. On I'm not sure this completely fixes #36600. One of the bits of feedback there was that it's hard to close the dialog, and I found this is still the case within the editor. Once I've navigated to the first block it's hard to get back. It seems to be because you need to use the horizontal arrow key to get to the button. I haven't really tested this overlay menu much before, but it seems like there are a couple of issues still outstanding after this fix:
|
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.
Ok, I was able to figure out how to reproduce eventually and this does fix it. Nice one!
It might be nice to just return children
when the menu isn't active, but I guess we can't guarantee the breakpoint a theme will use in JS.
I've unlinked the PR from the issue because I don't think we should close the issue until we address the other problems mentioned. |
Description
Addresses part of #36600; alternative to #36617.
This PR adds the
dialog
role andaria-modal="true"
to the navigation only when the modal is open. The attributes are added dynamically in both editor and front-end, so we don't need separate sets of markup for each state.How has this been tested?
Tested with VoiceOver in Safari; if navigation is not in responsive mode no dialog role is present.
Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
*.native.js
files for terms that need renaming or removal).