-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Edit Post: Hide overflowing content in visual editor wrapper to prevent block popovers from creating scrollbars #49978
Edit Post: Hide overflowing content in visual editor wrapper to prevent block popovers from creating scrollbars #49978
Conversation
…nt block popovers from creating scrollbars
Apologies for the large number of pings for reviews — while this is only a single line change, I thought I'd cast the net wide, just in case anyone's aware of problems this rule might cause! Feel free to ignore if this isn't an area any of you are working in 🙂 |
Size Change: +6 B (0%) Total Size: 1.37 MB
ℹ️ View Unchanged
|
From memory, I think the template editing mode and the Mobile / Tablet views are worth testing. I couldn't spot any regressions. |
I could reproduce problem and |
Thanks for testing! The site editor already has the |
That would do it 🤕 |
Thank you for attention to detail here, this one is important. I recall similar issues in the past, in case #30055 can provide some context on what used to be the issue and how that was fixed. |
Thanks for linking through that earlier discussion @jasmussen! It looks like the fix for the site editor was in #43332 from @ciampo and reviewed/merged by @talldan, which added the I think this one should be good to go now, but I'll just add a slightly bigger ping to @WordPress/gutenberg-core just in case. |
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.
Based on fix for site editor, this LGTM
Thanks for the approving review @ramonjd! Out of an abundance of caution, since this updates a styling rule of a prominent part of the editor, I'll leave this PR open until I'm back on Wednesday, and will merge in then if there aren't any objections 🙂 (If anyone else would like to, feel free to merge in before then) |
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.
✅ Confirmed works as expected LGTM
Thanks for the confidence check / reviews everyone! 🙇 |
What?
Add
overflow: hidden
to the.edit-post-visual-editor
class, so that block popovers don't cause additional scrollbars in the editor canvas.Why?
Block popovers are rendered into a popover slot that has the
edit-post-visual-editor
wrapper as its parent, withposition: relative
set on it. The current behaviour withBlockPopover
and floating UI is that popovers are rendered using absolute positioning, so when a block popover goes past the bottom of the screen, it results in theedit-post-visual-editor
wrapper overflowing. While we could also look into updating the popover behaviour here, I thought a good step would be to prevent these overflowing popovers from causing a scrollbar to be displayed. (The real post content is scrolled via the.interface-interface-skeleton__content
wrapper, so I think this should hopefully be a safe change).This issue currently only appears in the post editor, as the site editor already has a corresponding
overflow: hidden
rule on this line, added back in #44770. To test and reproduce the issue, if you're on a Mac, you'll likely want to set scrollbars in the OS to display Always for the issue to be visible.The kinds of popovers that result in the additional scrollbar include the block toolbar once it's scrolled past the bottom of the screen, but also Padding and Margin visualisers in the Group block, for example. I noticed this issue while working on a visualiser for position support over in #49321.
How?
overflow: hidden
to theedit-post-visual-editor
class.Testing Instructions
Before testing, make sure your OS is set to always display scrollbars. On a Mac, go to System Preferences > General and set it to Always. Here's a screenshot:
trunk
with a long post in the post editor, select a block somewhere around the middle of the page and scroll up and down the editor canvas. Notice that a second scrollbar appears once the block toolbar goes past the bottom of the screen.Testing Instructions for Keyboard
Screenshots or screencast
Before
2023-04-21.12.35.59.mp4
After
2023-04-21.12.37.11.mp4