-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Don't overlap canvas with inserter panel at large screens #64110
Changes from all commits
e831544
e433b16
aa4fd01
d250bc8
be2dbe7
c95391e
72c808a
ae37927
bbf1b2e
29314f8
f6a84af
86b42a2
2525a5f
f764e96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,5 +1,5 @@ | ||||||
$block-inserter-preview-height: 350px; | ||||||
$block-inserter-width: 350px; | ||||||
$block-quick-inserter-width: 350px; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Renaming this as I kept getting confused since this variable was only applicable to the quick inserter (the inline inserter in the canvas) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth an inline comment as well, defining what that is (for future reference?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
$block-inserter-tabs-height: 44px; | ||||||
|
||||||
.block-editor-inserter { | ||||||
|
@@ -24,6 +24,12 @@ $block-inserter-tabs-height: 44px; | |||||
&.show-as-tabs { | ||||||
gap: 0; | ||||||
} | ||||||
|
||||||
.block-editor-tabbed-sidebar { | ||||||
@include break-medium() { | ||||||
width: $secondary-sidebar-width; | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
.block-editor-inserter__popover.is-quick { | ||||||
|
@@ -85,6 +91,12 @@ $block-inserter-tabs-height: 44px; | |||||
height: 100%; | ||||||
position: relative; | ||||||
overflow: visible; | ||||||
|
||||||
&.show-panel { | ||||||
@include break-medium() { | ||||||
width: $secondary-sidebar-width + $sidebar-width; | ||||||
} | ||||||
} | ||||||
} | ||||||
|
||||||
.block-editor-inserter__inline-elements { | ||||||
|
@@ -299,14 +311,13 @@ $block-inserter-tabs-height: 44px; | |||||
@include break-medium { | ||||||
border-left: $border-width solid $gray-200; | ||||||
padding: 0; | ||||||
left: 100%; | ||||||
width: 300px; | ||||||
left: $secondary-sidebar-width; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is now a fixed number, but we need it to be to know how far to offset. The category panel content still needs to be absolutely positioned as it's within the flow of the tabs. |
||||||
width: $sidebar-width; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @richtabor This was previously fixed at 300px and updating this to $sidebar-width makes it thinner at 280px. I think it still looks good but wanted to flag this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yup, it's good to go. |
||||||
position: absolute; | ||||||
top: -$border-width; | ||||||
height: calc(100% + #{$border-width}); | ||||||
background: $gray-100; | ||||||
border-top: $border-width solid $gray-200; | ||||||
box-shadow: $border-width $border-width 0 0 rgba($color: #000, $alpha: 0.133); // 0.133 = $gray-200 but with alpha. | ||||||
|
||||||
.block-editor-inserter__media-list, | ||||||
.block-editor-block-patterns-list { | ||||||
|
@@ -366,7 +377,7 @@ $block-inserter-tabs-height: 44px; | |||||
max-width: 100%; | ||||||
|
||||||
@include break-medium { | ||||||
width: $block-inserter-width; | ||||||
width: $block-quick-inserter-width; | ||||||
} | ||||||
} | ||||||
|
||||||
|
@@ -679,12 +690,6 @@ $block-inserter-tabs-height: 44px; | |||||
height: 100%; | ||||||
} | ||||||
} | ||||||
|
||||||
// Remove doubled-up shadow that occurs when categories panel is opened, only in zoom out. | ||||||
// Shadow cannot be removed from the source, as it is required when not zoomed out. | ||||||
.block-editor-inserter__category-panel { | ||||||
box-shadow: none; | ||||||
} | ||||||
} | ||||||
|
||||||
.show-icon-labels { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
.block-editor-tabbed-sidebar { | ||
background-color: $white; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
flex-grow: 1; | ||
overflow: hidden; | ||
|
||
@include break-medium() { | ||
width: 350px; | ||
} | ||
Comment on lines
-7
to
-10
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't have been fixed at 350, as it shouldn't care what the parent width is. This would need to be removed to use it within the right side setting sidebar anyways. |
||
} | ||
|
||
.block-editor-tabbed-sidebar__tablist-and-close-button { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -182,30 +182,32 @@ function InterfaceSkeleton( | |
ariaLabel={ mergedLabels.secondarySidebar } | ||
as={ motion.div } | ||
initial="closed" | ||
animate={ | ||
isMobileViewport ? 'mobileOpen' : 'open' | ||
} | ||
animate="open" | ||
exit="closed" | ||
variants={ { | ||
open: { width: secondarySidebarSize.width }, | ||
closed: { width: 0 }, | ||
mobileOpen: { width: '100vw' }, | ||
} } | ||
transition={ defaultTransition } | ||
> | ||
<div | ||
<motion.div | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need two motion components? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One sets the width of the sidebar, and one allows the content to slide in on top of it. We need the sidebar to use a width so it can push the canvas over smoothly. The X value didn't work for that. And if we only use width, then then content of the sidebar reflows instead of being a fixed width. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the parent animation is a width, not a transform, the child doesn't move with it, as it is absolutely positioned. We did try using a transform for the parent but that broke the animations for the canvas, because the canvas resizes based on the width of the sidebar. |
||
style={ { | ||
position: 'absolute', | ||
width: isMobileViewport | ||
? '100vw' | ||
: 'fit-content', | ||
height: '100%', | ||
right: 0, | ||
left: 0, | ||
} } | ||
variants={ { | ||
open: { x: 0 }, | ||
closed: { x: '-100%' }, | ||
} } | ||
transition={ defaultTransition } | ||
> | ||
{ secondarySidebarResizeListener } | ||
{ secondarySidebar } | ||
</div> | ||
</motion.div> | ||
</NavigableRegion> | ||
) } | ||
</AnimatePresence> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to have the motion div inside each tab, or could we put this outside
categories.map
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tab won't mount its content until it is selected, so this is essentially one div until it mounts. It's possible it's better if we have it outside of it, but I'm concerned with that method since until we have a tabpanel selected, the semantics are off. I think this way with the motion div inside is safer semantically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The motion div only gets mounted when the category is mounted, so we don't generate loads of motion divs with this approach anyway.