Skip to content

Toolbar: Open the Network Admin submenu on the first tap on touch devices - #15865

Open
dhrupo wants to merge 1 commit into
WordPress:trunkfrom
dhrupo:66209-network-admin-mobile
Open

dhrupo wants to merge 1 commit into
WordPress:trunkfrom
dhrupo:66209-network-admin-mobile

Conversation

@dhrupo

@dhrupo dhrupo commented Nov 10, 2026 •

Copy link
Copy Markdown

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:

  1. Tap "My Sites" in the admin bar — the submenu opens.
  2. Tap "Network Admin".

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 never preventDefault()-ed and the link navigated (nested popovers were only ever reached by hover).

Fix

In mobileHover():

  • Only handle the tap when the resolved .menupop wrapper is the popover the listener is attached to (event.currentTarget), so one tap does not toggle every popover the event bubbles through.
  • For a tap inside .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-admin stays menupop (no hover), submenu never displayed.
After the patch:

  • First tap on "Network Admin": stays on the page, li#wp-admin-bar-network-admin becomes menupop hover, its submenu is block/visible.
  • Second tap: hover removed (submenu collapses).
  • Tapping a plain submenu link (e.g. Network Admin > Dashboard) still navigates.
  • Top-level popovers (My Sites, Updates, My Account) keep their previous toggle behavior.

npx wp-scripts lint-js src/js/_enqueues/lib/admin-bar.js passes.

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.)

Network Admin submenu open on a touch device after the patch

…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.
@github-actions

Copy link
Copy Markdown

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:

Props dhrupo.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.


Props Bot commands

You can trigger Props Bot actions by commenting on this PR:

  • @propsbot add <username> to give props to a GitHub user. Requires write access.
  • @propsbot remove <username> to leave a user out of the props. Requires write access.
  • @propsbot refresh to refresh this list. Adding the props-bot label works too.

@github-actions

Copy link
Copy Markdown

Test using WordPress Playground

The 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

  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant