-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix site editor toolbar when block is bigger than viewport #43548
Fix site editor toolbar when block is bigger than viewport #43548
Conversation
Size Change: +29 B (0%) Total Size: 1.25 MB
ℹ️ View Unchanged
|
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.
I'm not the most familiar with Popover internals, but the logic looks sound and it does solve the problem! I assume the draft status is due to #43546 still being in progress?
944e37b
to
4d370c0
Compare
f3af613
to
13d941a
Compare
4d370c0
to
8b654c6
Compare
8b654c6
to
9df5913
Compare
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.
LGTM 🚀
Just noting that the "resizing" bug had already been fixed by #43546, since it allowed the block toolbar to always set resize
to false
(which means that the issue reported in #43541 should already be fixed on trunk
)
What this PR changes (fixes) is the edge case scenario in which a block that is taller than the viewport happens to also be the first block.
On trunk
, since there's no space above the block, the toolbar flips, and therefore it can't be seen on screen (which may confuse the user)
trunk.mp4
With the changes from this PR, selecting a block that doesn't have space above it but is taller than the viewport will prevent the flip and fallback to the shift behavior, therefore allowing the toolbar to be visible
What?
Fixes #43541 (this PR is based on #43546, and that should be merged first)
Why?
#42887 introduced an issue when the block is larger than the viewport. In this situation floating-ui's 'resize' middleware is making the block toolbar smaller to fit the available space which may make it appear as though the toolbar is behind the block. The toolbar can also sometimes appear off-screen below the block (see the 'before' video).
How?
To fix this, resize needs to be switched off, which #43546 helps with.
Once that's resolved, the toolbar still often ends up offscreen, so some extra logic needs to be added to
useBlockToolbarPopoverProps
to account for situations where the block is larger than the viewport.Testing Instructions
Screenshots or screencast
Before
Kapture.2022-08-24.at.14.38.55.mp4
After
Kapture.2022-08-24.at.14.40.24.mp4