Skip to content

Fix: Hide the empty Meta Boxes pane when only side meta boxes are present and the pane is closed - #84306

Closed
umeshnevase wants to merge 2 commits into
WordPress:trunkfrom
umeshnevase:fix/84173-hide-empty-meta-boxes-pane-below-editor
Closed

umeshnevase wants to merge 2 commits into
WordPress:trunkfrom
umeshnevase:fix/84173-hide-empty-meta-boxes-pane-below-editor

Conversation

@umeshnevase

Copy link
Copy Markdown

What?

Closes #84173

Why?

The pane below the editor only holds the normal and advanced meta box locations. side meta boxes are rendered in the sidebar. The check that decides whether to render the pane also counted side, so a post with only side meta boxes (or none visible) showed an empty "Meta Boxes" toggle bar, whether the pane was open or closed.

How?

In MetaBoxesMain (packages/edit-post/src/components/layout/index.jsx), the hasAnyVisible check now looks only at isMetaBoxLocationVisible( 'normal' ) and isMetaBoxLocationVisible( 'advanced' ). When neither is visible, the pane isn't rendered. Side meta boxes are unaffected.

MetaBoxesMain is now a named export so it can be unit tested.

Tests added:

  • Unit: isMetaBoxLocationVisible selector cases in selectors.jsdom.test.js.
  • Component: layout/test/meta-boxes-main.jsdom.test.js covers no meta boxes, side only, normal, advanced, and normal plus side.
  • E2E: meta-boxes-pane.spec.js, with a new test plugin meta-box-side-only.php that registers a side-only meta box.

Testing Instructions

  1. Activate a plugin that registers a meta box in the side location only (or gutenberg-test-plugin-meta-box-side-only from packages/e2e-tests/plugins).
  2. Open a new post. The side meta box appears in the sidebar and there is no "Meta Boxes" bar below the editor.
  3. Deactivate all meta box plugins and open a new post. There is no "Meta Boxes" bar.
  4. Activate a plugin with a normal meta box (e.g. gutenberg-test-plugin-meta-box) and open a new post. The "Meta Boxes" bar appears and can be toggled open and closed.
  5. Activate both the normal and side plugins. The bar still appears.

Automated:

npm run test:unit:vitest -- packages/edit-post
npm run test:e2e -- test/e2e/specs/editor/plugins/meta-boxes-pane.spec.js

Testing Instructions for Keyboard

  1. With a normal meta box active, Tab to the "Meta Boxes" button and press Enter or Space. The pane opens and closes, and aria-expanded updates.
  2. With only a side meta box active (or none), Tab through the editor. There is no "Meta Boxes" button or empty region to land on.

Use of AI Tools

This PR was authored with assistance from Claude Code (Anthropic). Claude Code helped write the fix, the changelog entry and the unit, component and E2E tests. I reviewed all of the generated code and ran the unit tests locally.

…sent

The Meta Boxes pane below the editor only renders the `normal` and
`advanced` locations, but its visibility check also counted `side`.
With only side meta boxes (or none visible), an empty pane was still
shown, open or closed.

Only consider the `normal` and `advanced` locations when deciding
whether to render the pane. Side meta boxes remain in the sidebar.

Add unit tests for `isMetaBoxLocationVisible` and `MetaBoxesMain`, and
an E2E spec with a side-only meta box test plugin.
@github-actions

github-actions Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

🤖 PR meta 🤖

👋 Welcome

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @umeshnevase! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

🎉 Props

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: umeshnevase <umeshnevase@git.wordpress.org>
Co-authored-by: andfinally <andfinally@git.wordpress.org>

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

Updated as activity occurs, without notifying anyone named here. Add the props-bot label to refresh.

🏷️ Labels

This pull request needs exactly one label indicating its type, and has 0.

  • Required: any label starting with [Type].
  • Found: none.

Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you.

@github-actions github-actions Bot added [Package] Edit Post /packages/edit-post [Package] E2E Tests /packages/e2e-tests First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository labels Oct 8, 2026
@t-hamano

t-hamano commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Hi @umeshnevase, thanks for your contribution.

I don't think this is the ideal approach, so I'm going to close this issue. Please see #84173 (comment) for more details.

@t-hamano t-hamano closed this Oct 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] E2E Tests /packages/e2e-tests [Package] Edit Post /packages/edit-post

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MetaBoxesMain renders empty "Meta Boxes" panel when there are only sidebar metaboxes

2 participants