Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always render metaboxes areas and use CSS to hide them when all panel are inactive #67228

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,6 @@ function MetaBoxesMain( { isLegacy } ) {
}
};

if ( ! hasAnyVisible ) {
return;
}

const contents = (
<div
className={ clsx(
Expand Down Expand Up @@ -276,19 +272,29 @@ function MetaBoxesMain( { isLegacy } ) {
}
};
const className = 'edit-post-meta-boxes-main';
const paneLabel = __( 'Meta Boxes' );
const paneLabel = hasAnyVisible ? __( 'Meta Boxes' ) : undefined;
let Pane, paneProps;
if ( isShort ) {
Pane = NavigableRegion;
// Only use a NavigableRegion when the Meta Boxes area is visible.
Pane = hasAnyVisible ? NavigableRegion : 'div';
paneProps = {
className: clsx( className, 'is-toggle-only' ),
className: clsx(
className,
'is-toggle-only',
! hasAnyVisible && 'is-hidden'
),
};
} else {
Pane = ResizableBox;
paneProps = /** @type {Parameters<typeof ResizableBox>[0]} */ ( {
as: NavigableRegion,
// Only use a NavigableRegion when the Meta Boxes area is visible.
as: hasAnyVisible ? NavigableRegion : 'div',
ref: metaBoxesMainRef,
className: clsx( className, 'is-resizable' ),
className: clsx(
className,
'is-resizable',
! hasAnyVisible && 'is-hidden'
),
defaultSize: { height: openHeight },
minHeight: min,
maxHeight: usedMax,
Expand Down
4 changes: 4 additions & 0 deletions packages/edit-post/src/components/layout/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
&.is-resizable {
padding-block-start: $grid-unit-30;
}

&.is-hidden {
display: none;
}
}

.edit-post-meta-boxes-main__presenter {
Expand Down
Loading