Repository navigation
Administration: Fix Dashboard layout when widgets are re-enabled with reordering disabled. - #16516
ankit-addweb wants to merge 2 commits into
Conversation
…en widgets are re-enabled. When meta box reordering is disabled, empty sortable areas are hidden with CSS, so postboxes._mark_area() skipped them via the :visible check and left a stale empty-container class behind. Re-enabling widgets and then reordering produced overlapping "Add boxes from the Screen Options menu" text.
…ate. When meta box reordering is disabled, empty areas are hidden, so a widget re-checked in Screen Options stayed hidden inside one and was saved as hidden. Run postboxes._mark_area() before save_state() so the widget is shown and saved as visible. See #66943.
|
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/66943
Problem
With "Allow screen elements to be rearranged" unchecked, empty Dashboard sortable areas are hidden with CSS. Two things go wrong when widgets are re-enabled:
postboxes._mark_area()only checks:visiblesortables, so hidden areas keep a staleempty-containerclass. Turning reordering back on then shows the dashed drop zone and the "Add boxes from the Screen Options menu" text overlapping the widgets..hide-postbox-toghandler,save_state()ran before_mark_area(). A re-checked widget was still inside a hidden.empty-container, so it was:hiddenand saved as hidden (it disappeared on refresh).Fix
In
src/js/_enqueues/admin/postbox.js:_mark_area()now removesempty-containerfrom all#dashboard-widgetsand#post-body.meta-box-sortablesbefore filtering by:visible, and re-adds it only to areas that are actually empty._mark_area()now runs beforesave_state()in the.hide-postbox-toghandler, so re-checked widgets are shown and saved as visible.Testing