Skip to content

Commit

Permalink
Make Distraction Free not conditional on viewport width (#63949)
Browse files Browse the repository at this point in the history
* check for isWideViewport

* make distraction free always available

* Ensure mobile styles work with and without distraction free

* use isLargeViewport "medium" instead

* use ! isMobileViewport instead of isLargeViewport
  • Loading branch information
richtabor authored Aug 22, 2024
1 parent 0e88cda commit 54eee32
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
6 changes: 2 additions & 4 deletions packages/editor/src/components/editor-interface/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export default function EditorInterface( {
select( blockEditorStore ).__unstableGetEditorMode(),
};
}, [] );
const isWideViewport = useViewportMatch( 'large' );
const isLargeViewport = useViewportMatch( 'medium' );
const secondarySidebarLabel = isListViewOpened
? __( 'Document Overview' )
Expand All @@ -122,11 +121,10 @@ export default function EditorInterface( {
return (
<InterfaceSkeleton
enableRegionNavigation={ enableRegionNavigation }
isDistractionFree={ isDistractionFree && isWideViewport }
isDistractionFree={ isDistractionFree }
className={ clsx( 'editor-editor-interface', className, {
'is-entity-save-view-open': !! entitiesSavedStatesCallback,
'is-distraction-free':
isDistractionFree && isWideViewport && ! isPreviewMode,
'is-distraction-free': isDistractionFree && ! isPreviewMode,
} ) }
labels={ {
...interfaceLabels,
Expand Down
9 changes: 6 additions & 3 deletions packages/editor/src/components/header/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@
}

.editor-header__post-preview-button {
@include break-small {
@include break-mobile {
display: none;
}
}
Expand All @@ -240,10 +240,13 @@

.editor-header {
background-color: $white;
border-bottom: 1px solid #e0e0e0;
position: absolute;
width: 100%;

@include break-medium {
border-bottom: 1px solid #e0e0e0;
position: absolute;
}


// hide some parts
& > .edit-post-header__settings > .edit-post-header__post-preview-button {
Expand Down
8 changes: 4 additions & 4 deletions packages/interface/src/components/interface-skeleton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,22 @@ function InterfaceSkeleton(
className="interface-interface-skeleton__header"
aria-label={ mergedLabels.header }
initial={
isDistractionFree
isDistractionFree && ! isMobileViewport
? 'distractionFreeHidden'
: 'hidden'
}
whileHover={
isDistractionFree
isDistractionFree && ! isMobileViewport
? 'distractionFreeHover'
: 'visible'
}
animate={
isDistractionFree
isDistractionFree && ! isMobileViewport
? 'distractionFreeDisabled'
: 'visible'
}
exit={
isDistractionFree
isDistractionFree && ! isMobileViewport
? 'distractionFreeHidden'
: 'hidden'
}
Expand Down

1 comment on commit 54eee32

@github-actions
Copy link

Choose a reason for hiding this comment

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

Flaky tests detected in 54eee32.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10499671510
📝 Reported issues:

Please sign in to comment.