-
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
Dimension visualizers do not display correctly in specific situations #47471
Comments
@ndiego you are correct that it is related to the block gap - if I remove the top margin that is added to the second paragraph it fixes it. I will try and work out how we can get the overlay to account for this margin. |
Looks like it is something to do with the calculation of the translateY value by the popover library. Currently, this value matches offsetTop which pushes the box out by the size of the block margin, but if translateY is adjusted to offsetHeight in dev tools the popover then sits in the right place. |
It looks like what's happening is that the visualizer's popover component is receiving the same Here's the box model for the popover when block spacing is applied, showing the 176px margin at the top: This is partly a side effect of the way the popover renders inline within the block list as discovered over on #47139. I'm not sure why it does that, but it seems like it's been the case for a long time. Probably the best thing would be to make the popover render in a slot outside of the editor canvas, but I noticed in #47139 that this did introduce some other issues that made the visualizer inaccurate 😄 . I'll put together a PR to make it use a slot, and then we can work through those other issues one by one. |
Description
Dimension visualizers for padding and margin are not always accurately displayed in the Editor. If a block is positioned at the top of the post or the top of a container block, hovering over a dimension control shifts the block down slightly. The visualizers do appear correctly, but the block is shifted by what appears to be the site-wide
blockGap
value.Hovering over a second block with active padding or margin displays the visualizers, but they are off. See the gif below.
I believe the markup for the visualizers is getting hit by
blockGap
in some way. 🤔Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
Environment info
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: