Skip to content

Commit 9adf49a

Browse files
committed
Navigation Overlay: Improve handling of open overlay.
1 parent c0ae9b2 commit 9adf49a

File tree

2 files changed

+50
-5
lines changed

2 files changed

+50
-5
lines changed

packages/block-library/src/navigation/editor.scss

Lines changed: 48 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -385,22 +385,65 @@ $color-control-label-height: 20px;
385385
}
386386

387387
// Emulate the fullscreen editing inside the editor.
388+
// Most of this can be removed when the iframe lands.
389+
390+
// When not fullscreen.
388391
.wp-block-navigation__responsive-container.is-menu-open {
389392
position: fixed;
393+
top: $admin-bar-height-big + $header-height + $block-toolbar-height + $border-width;
394+
395+
@include break-medium() {
396+
top: $admin-bar-height + $header-height + $border-width;
397+
}
390398

391-
// Handle top position.
392-
// For now, the editing of menu items in the mobile view only happens <600px.
393-
// That means we only have to consider the big adminbar height (<783px).
394-
// And in that view we also know that the toolbar is stacked.
395-
body.admin-bar & {
399+
// Navigation sidebar rules.
400+
@include break-medium() {
401+
left: $admin-sidebar-width-collapsed;
402+
}
403+
@include break-large() {
404+
left: $admin-sidebar-width;
405+
}
406+
}
407+
408+
.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open {
409+
@include break-medium() {
410+
top: $admin-bar-height + $header-height + $block-toolbar-height + $border-width;
411+
}
412+
}
413+
414+
.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,
415+
.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open {
416+
top: $admin-bar-height + $header-height + $block-toolbar-height + $border-width;
417+
}
418+
419+
.is-sidebar-opened .wp-block-navigation__responsive-container.is-menu-open {
420+
right: $sidebar-width;
421+
}
422+
423+
// When fullscreen.
424+
.is-fullscreen-mode {
425+
.wp-block-navigation__responsive-container.is-menu-open {
426+
left: 0; // Unset the value from non fullscreen mode.
396427
top: $admin-bar-height-big + $header-height + $block-toolbar-height + $border-width;
397428

398429
@include break-medium() {
399430
top: $header-height + $border-width;
400431
}
401432
}
433+
434+
.has-fixed-toolbar .wp-block-navigation__responsive-container.is-menu-open {
435+
@include break-medium() {
436+
top: $header-height + $block-toolbar-height + $border-width;
437+
}
438+
}
439+
440+
.is-mobile-preview .wp-block-navigation__responsive-container.is-menu-open,
441+
.is-tablet-preview .wp-block-navigation__responsive-container.is-menu-open {
442+
top: $header-height + $block-toolbar-height + $border-width;
443+
}
402444
}
403445

446+
404447
// Without this, the block cannot be selected, nor does the right container get focus.
405448
// @todo: this is disruptive. Ideally we can retire a few of the containers,
406449
// so focus is applied naturally on the block container.

packages/edit-post/src/components/visual-editor/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default function VisualEditor( { styles } ) {
137137
const resizedCanvasStyles = useResizeCanvas( deviceType, isTemplateMode );
138138
const defaultLayout = useSetting( 'layout' );
139139
const { contentSize, wideSize } = defaultLayout || {};
140+
const previewMode = 'is-' + deviceType.toLowerCase() + '-preview';
140141

141142
let animatedStyles = isTemplateMode
142143
? templateModeStyles
@@ -219,6 +220,7 @@ export default function VisualEditor( { styles } ) {
219220
<motion.div
220221
animate={ animatedStyles }
221222
initial={ desktopCanvasStyles }
223+
className={ previewMode }
222224
>
223225
<MaybeIframe
224226
isTemplateMode={ isTemplateMode }

0 commit comments

Comments
 (0)