Repository navigation
Conversation
…ices. On touch devices, mobileHover() returned early for any tap inside a submenu, so tapping the Network Admin item (a nested menu popover) navigated away instead of opening its submenu. Only handle taps for the menu popover that owns the tapped toggle, and toggle nested popovers on the first tap; plain submenu links keep navigating. Props joedolson (report). Fixes #66209.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/66209
Summary
On touch devices, tapping the Network Admin item in the admin bar navigates to the network dashboard instead of opening its submenu, so the submenu entries (Sites, Users, Themes, Plugins, Settings) are unreachable and the whole menu collapses. The Network Admin item is a nested menu popover inside the My Sites submenu.
Reproduction
Multisite, super admin, touch device (or touch emulation) with a viewport under 782 px:
The browser navigates to the network dashboard; the submenu never opens.
Cause:
mobileHover()returned early for every tap inside.ab-sub-wrapper, which includes nested popover toggles, so the tap was neverpreventDefault()-ed and the link navigated (nested popovers were only ever reached by hover).Fix
In
mobileHover():.menupopwrapper is the popover the listener is attached to (event.currentTarget), so one tap does not toggle every popover the event bubbles through..ab-sub-wrapper, keep navigating unless the tap is on a nested popover's own.ab-item; a nested popover toggle gets the same first-tap-opens / second-tap-collapses behavior the top-level items already have.Testing
Live-tested against WordPress 7.2-beta4-65367 (nightly) multisite with Playwright touch emulation (iPhone-class UA, 390px viewport, touch events), admin bar on the front end and in wp-admin:
Before the patch — tap "Network Admin": URL becomes
/wp-admin/network/,li#wp-admin-bar-network-adminstaysmenupop(no hover), submenu never displayed.After the patch:
li#wp-admin-bar-network-adminbecomesmenupop hover, its submenu isblock/visible.npx wp-scripts lint-js src/js/_enqueues/lib/admin-bar.jspasses.Use of AI Tools
AI assistance: Kimi (Moonshot AI) drafted the patch and the scripted reproduction; I reviewed every change, ran the before/after testing myself, and verified all results.
Screenshot
Touch device (390px viewport), patched behavior on nightly 7.2-beta4-65367 multisite: the first tap on Network Admin opens its submenu — Dashboard, Sites, Users, Themes, Plugins, Settings all reachable. (The submenus are styled inline for the capture; the tap-driven open is what the patch provides.)