Repository navigation
Administration: Prevent mobile admin menu from overlapping main content and #wpfooter, and fix toolbar dropdown interactions - #15404
Conversation
…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.
|
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/66360
See also: https://core.trac.wordpress.org/ticket/22660
Description
This PR resolves two related mobile/responsive administration issues:
<= 782px) is expanded,#adminmenuwrap(width 190px) overlapped both the main content and#wpfootertext ("Thank you for creating with WordPress.").#wpbodyis statically positioned, rendering.wp-responsive-open #wpbody { right: -16em; }ineffective.#wpfootersits outside#wpcontentand was omitted from the shift rule, and was additionally pinned byleft: 0.#wpwrap.wp-responsive-open { overflow-x: hidden; }was scoped tomax-width: 600px, causing horizontal scrollbar spillover on screens between 601px and 782px.$adminbar.find( '.hover' ).removeClass( 'hover' )and immediately closing the toolbar submenu.Changes
src/wp-admin/css/common.css:#wpcontent(which wraps#wpbody) and#wpfooter:#wpwrap.wp-responsive-open { overflow-x: hidden; }into@media screen and (max-width: 782px).src/js/_enqueues/admin/common.js:$wpwrap.removeClass( 'wp-responsive-open' )) without invoking the toggle button click handler so admin bar submenus remain open.#adminmenumain(covering both menu and backdrop).Testing
#wpcontentand#wpfooterare fully cleared by the open sidebar without overlapping.npx eslint src/js/_enqueues/admin/common.js(0 errors).npm run grunt precommit:css.Props therssoftware.
Fixes #66360.
See #22660.