Skip to content

Administration: Prevent mobile admin menu from overlapping main content and #wpfooter, and fix toolbar dropdown interactions - #15404

Open
robelsust wants to merge 1 commit into
WordPress:trunkfrom
robelsust:fix/66360-mobile-menu-footer-overlap
Open

robelsust wants to merge 1 commit into
WordPress:trunkfrom
robelsust:fix/66360-mobile-menu-footer-overlap

Conversation

@robelsust

@robelsust robelsust commented Nov 3, 2026 •

Copy link
Copy Markdown

Trac ticket: https://core.trac.wordpress.org/ticket/66360
See also: https://core.trac.wordpress.org/ticket/22660

Description

This PR resolves two related mobile/responsive administration issues:

  1. Trac Ticket #66360: When the responsive admin menu (<= 782px) is expanded, #adminmenuwrap (width 190px) overlapped both the main content and #wpfooter text ("Thank you for creating with WordPress.").
    • #wpbody is statically positioned, rendering .wp-responsive-open #wpbody { right: -16em; } ineffective.
    • #wpfooter sits outside #wpcontent and was omitted from the shift rule, and was additionally pinned by left: 0.
    • #wpwrap.wp-responsive-open { overflow-x: hidden; } was scoped to max-width: 600px, causing horizontal scrollbar spillover on screens between 601px and 782px.
  2. Trac Ticket #22660: When tapping admin bar dropdowns (such as "My Sites") while the responsive menu was open, the outside-click handler re-triggered the toggle button's click event, executing $adminbar.find( '.hover' ).removeClass( 'hover' ) and immediately closing the toolbar submenu.

Changes

  • In src/wp-admin/css/common.css:
    • Updated the responsive offset rule to target #wpcontent (which wraps #wpbody) and #wpfooter:
      .wp-responsive-open #wpcontent,
      .wp-responsive-open #wpfooter {
          right: -16em;
          left: auto;
      }
    • Moved #wpwrap.wp-responsive-open { overflow-x: hidden; } into @media screen and (max-width: 782px).
  • In src/js/_enqueues/admin/common.js:
    • Close the responsive menu directly on outside click and Escape/Tab ($wpwrap.removeClass( 'wp-responsive-open' )) without invoking the toggle button click handler so admin bar submenus remain open.
    • Broadened container boundary detection to check element identity and include #adminmenumain (covering both menu and backdrop).

Testing

  • Verified in browser across 768px, 600px, and 375px viewports in both LTR and RTL modes.
  • Verified that both #wpcontent and #wpfooter are fully cleared by the open sidebar without overlapping.
  • Verified that tapping "My Sites" closes the mobile sidebar while successfully expanding the "My Sites" dropdown.
  • Verified zero horizontal page scrolling.
  • Ran npx eslint src/js/_enqueues/admin/common.js (0 errors).
  • Ran npm run grunt precommit:css.

Props therssoftware.
Fixes #66360.
See #22660.

…nt and #wpfooter, and fix toolbar dropdown interactions.

In responsive viewports (<= 782px), when the admin menu is expanded (#wpwrap.wp-responsive-open):
- Shifting #wpbody right by -16em had no effect because #wpbody is statically positioned, while #wpfooter (located outside #wpcontent) remained unshifted and constrained by left: 0, causing the open sidebar to overlap both main content and the footer text. Update the rule to shift #wpcontent (which contains #wpbody) and #wpfooter together, resetting left: auto so that the negative right offset properly moves both off-canvas.
- Move #wpwrap.wp-responsive-open { overflow-x: hidden; } from max-width: 600px to max-width: 782px to prevent horizontal page scrolling across all responsive tablet and mobile viewports.
- In common.js, close the responsive menu directly on outside clicks or Escape/Tab without triggering the menu toggle click event, preventing unnecessary stripping of .hover on toolbar submenus like 'My Sites'. Also broaden container boundary detection to check both the toggle and sidebar containers directly.

Props therssoftware.
Fixes #66360.
See #22660.
@github-actions

github-actions Bot commented Nov 3, 2026

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

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

github-actions Bot commented Nov 3, 2026

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