Navigation: Fixes aria-expanded not updating on hover submenu inside overlay#77563
Navigation: Fixes aria-expanded not updating on hover submenu inside overlay#77563himanshupathak95 wants to merge 1 commit intoWordPress:trunkfrom
aria-expanded not updating on hover submenu inside overlay#77563Conversation
… in overlay context
e58f475 to
ef44f7e
Compare
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Unlinked AccountsThe following contributors have not linked their GitHub and WordPress.org accounts: @s56bouya. Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases. If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
What?
Closes #76658
When
Submenu Visibilityis set toHover, the toggle button'saria-expandedattribute does not update totruewhen hovering over a submenu inside a Navigation Overlay. The submenu was visually shown, butaria-expandedremainedfalse, creating a mismatch that screen readers would report as "closed" for a visible submenu.Why?
The
openMenuOnHoverandcloseMenuOnHoveraction handlers contained a guard that prevented them from running when the parent overlay was already open becauseoverlayOpenedByhad a truthy value.Since
pointerenterdirectives are only added to<li>elements whensubmenuVisibility === 'hover', removing the guard is safe since those events can only fire inside an already-open overlay, which is exactly when the state should be updated.How?
Removed the
overlayOpenedByguard fromopenMenuOnHoverandcloseMenuOnHoverinpackages/block-library/src/navigation/view.js.Testing Instructions
Overlay MenutoAlways).<button>—aria-expandedshould now be"true"while hovered.aria-expandedshould return to"false".are unaffected.
Screenshots or screencast
Before
Screen.Recording.2026-04-22.at.21.30.43.mov
After
Screen.Recording.2026-04-22.at.21.27.40.mov