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

Distraction Free Mode: Don't show the metaboxes #48947

Merged
merged 4 commits into from
Mar 9, 2023
Merged
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
14 changes: 6 additions & 8 deletions packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function Layout( { styles } ) {
isInserterOpened,
isListViewOpened,
showIconLabels,
isDistractionFreeMode,
isDistractionFree,
showBlockBreadcrumbs,
isTemplateMode,
documentLabel,
Expand Down Expand Up @@ -116,7 +116,7 @@ function Layout( { styles } ) {
).getAllShortcutKeyCombinations( 'core/edit-post/next-region' ),
showIconLabels:
select( editPostStore ).isFeatureActive( 'showIconLabels' ),
isDistractionFreeMode:
isDistractionFree:
select( editPostStore ).isFeatureActive( 'distractionFree' ),
showBlockBreadcrumbs: select( editPostStore ).isFeatureActive(
'showBlockBreadcrumbs'
Expand All @@ -126,8 +126,6 @@ function Layout( { styles } ) {
};
}, [] );

const isDistractionFree = isDistractionFreeMode && isLargeViewport;

const openSidebarPanel = () =>
openGeneralSidebar(
hasBlockSelected ? 'edit-post/block' : 'edit-post/document'
Expand Down Expand Up @@ -164,7 +162,7 @@ function Layout( { styles } ) {
'has-fixed-toolbar': hasFixedToolbar,
'has-metaboxes': hasActiveMetaboxes,
'show-icon-labels': showIconLabels,
'is-distraction-free': isDistractionFree,
'is-distraction-free': isDistractionFree && isLargeViewport,
'is-entity-save-view-open': !! entitiesSavedStatesCallback,
} );

Expand Down Expand Up @@ -206,7 +204,7 @@ function Layout( { styles } ) {
<EditorKeyboardShortcutsRegister />
<SettingsSidebar />
<InterfaceSkeleton
isDistractionFree={ isDistractionFree }
isDistractionFree={ isDistractionFree && isLargeViewport }
className={ className }
labels={ {
...interfaceLabels,
Expand Down Expand Up @@ -252,7 +250,7 @@ function Layout( { styles } ) {
{ isRichEditingEnabled && mode === 'visual' && (
<VisualEditor styles={ styles } />
) }
{ ! isTemplateMode && (
{ ! isDistractionFree && ! isTemplateMode && (
<div className="edit-post-layout__metaboxes">
<MetaBoxes location="normal" />
<MetaBoxes location="advanced" />
Expand All @@ -265,8 +263,8 @@ function Layout( { styles } ) {
}
footer={
! isDistractionFree &&
showBlockBreadcrumbs &&
! isMobileViewport &&
showBlockBreadcrumbs &&
isRichEditingEnabled &&
mode === 'visual' && (
Comment on lines 265 to 269
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing appears to have changed here, but the isDistractionFree variable no longer contains the viewport width condition.

This fixes another problem. In trunk, there is a "gap" in the viewport width generated by this conditional statement, so the breadcrumb list is displayed when the viewport width is between 782px and 960px, even in distraction-free mode, as shown below.

87835d47b037b1cc67e9e3bfdcc5f478.mp4

<div className="edit-post-layout__footer">
Expand Down