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
Remove not needed aria-hidden attribute in navigation block experiment #51044
Remove not needed aria-hidden attribute in navigation block experiment #51044
Conversation
Size Change: +192 B (0%) Total Size: 1.39 MB
ℹ️ View Unchanged
|
@SantosGuillamot Correct. The only time Hope this helps. |
It totally does! Thanks a lot for the information Taking a look at the styles, it seems that it is adding |
WordPress#51044) * Add aria-hidden selector * Use `offsetParent` to check if the menu is visible * Remove `aria-hidden` attribute
What?
As reported here: In the version of the navigation block using the Interactivity API, in some cases we are defining
aria-hidden: true
even for the desktop version, which is not correct. This pull request aims to solve that.Why?
It causes issues with screen readers in the desktop version, when the elements are shown but
aria-hidden
is true.How?
I added a selector that reads:If the menu is open ->aria-hidden: false
.If the menu is not open -> It checks if the "Open menu" is visible. If it is,aria-hidden: true
. If it isn'taria-hidden: false
.I couldn't find any other way of checking this because, if I am not mistaken, it is handled with CSS.I finally removed the aria-hidden attribute directly because it seems that it shouldn't be used in this use case, where the element is hidden using
display: none
, according to MDN docs: "aria-hidden="true" should not be added when the element or the element's ancestor is hidden with display: none".Testing Instructions
aria-hidden
inside thewp-block-navigation__responsive-container
is true when the menu is wrapped, and false when the menu opens.aria-hidden
is always false.Screenshots or screencast
Desktop version
Mobile version