Skip to content

Administration: Fix Dashboard layout when widgets are re-enabled with reordering disabled. - #16516

Open
ankit-addweb wants to merge 2 commits into
WordPress:trunkfrom
ankit-addweb:fix/dashboard-empty-container-stale-class
Open

ankit-addweb wants to merge 2 commits into
WordPress:trunkfrom
ankit-addweb:fix/dashboard-empty-container-stale-class

Conversation

@ankit-addweb

Copy link
Copy Markdown

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 :visible sortables, so hidden areas keep a stale empty-container class. Turning reordering back on then shows the dashed drop zone and the "Add boxes from the Screen Options menu" text overlapping the widgets.
  • In the .hide-postbox-tog handler, save_state() ran before _mark_area(). A re-checked widget was still inside a hidden .empty-container, so it was :hidden and saved as hidden (it disappeared on refresh).

Fix

In src/js/_enqueues/admin/postbox.js:

  • _mark_area() now removes empty-container from all #dashboard-widgets and #post-body .meta-box-sortables before filtering by :visible, and re-adds it only to areas that are actually empty.
  • _mark_area() now runs before save_state() in the .hide-postbox-tog handler, so re-checked widgets are shown and saved as visible.

Testing

  1. Dashboard > Screen Options: uncheck "Allow screen elements to be rearranged".
  2. Uncheck all dashboard widgets.
  3. Check Site Health Status and Quick Draft again. They should appear immediately.
  4. Check "Allow screen elements to be rearranged". No "Add boxes from the Screen Options menu" text should overlap the widgets.
  5. Refresh. The widgets should still be visible.
  6. Confirm "Drag boxes here" still shows for empty columns when reordering is on, and the post edit screen side area keeps its empty state.

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

github-actions Bot commented Dec 4, 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 ankitp47.

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 or WordPress.org 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 Dec 4, 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