-
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
Fix image layout shift from placeholder to selected placeholder #59857
Conversation
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
@@ -212,7 +212,7 @@ | |||
|
|||
// By painting the borders here, we enable them to be replaced by the Border control. | |||
@include placeholder-style(); | |||
overflow: auto; | |||
overflow: hidden; |
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.
Overflow hidden seems risky here as it could cause some controls to be inaccessible via the UI 🤔
Would it make sense to only apply overflow hidden when the block is not selected/reset it to auto when the block is selected?
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.
They are already hidden in the UI, this is not accessible in any way shape or form:
This is why we've increasingly been careful about using the generic Placeholder pattern, and in fact why the Site Logo and Featured Image placeholders are patterns to follow for the best results, rather than the existing component. Those feature only a single button, acknowledging the fact that so long as you can insert a block into a colum that's 50x50px, they simply need to scale. There's a bit more discussion here: #58685 (comment)
I hear you though, there may be a larger refactor necessary of the image block component. Perhaps #59275 can lead the way?
Alternatively I'd recommend a revert of the original PR to fix it.
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.
Yeah in the screenshot you have there it is a very subpar experience. But technically (and I know because I had to fight this a few times already) you can still scroll the area and find what you are looking for.
I would love a refactor of this. But I think an immediate fix would be to only apply the
overflow: hidden
when the block is not selected. That would still prevent the layout shift but still retain the ability to scroll this area here
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 would love a refactor of this. But I think an immediate fix would be to only apply the overflow: hidden when the block is not selected. That would still prevent the layout shift but still retain the ability to scroll this area here
I have to temporarily move on to a separate thing, but good point, I can try this later. Otherwise if you're up for it feel free to push directly to the branch.
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.
Size Change: -29 B (0%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
Flaky tests detected in bd2091e. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/8277502618
|
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.
This is a good interim fix :)
Thanks for working on it
…Press#59857) * Fix image layout shift from placeholder to selected placeholder * Only when not selected. * Update changelog.
What?
Alternative to #59305. Still fixes #59226.
The original fix caused the unselected image block placeholder to collapse in height, so there's a layout shift between selected and unselected states:
For reference, before it would look like this, without the layout shift:
This was caused by hiding the fieldset when the block was unselected. This PR hides overflow instead. First, removing the original fix restored the scrollbars:
The overflow rule hides them again:
Why?
Selecting and deselecting blocks should not cause layout shifts.
Testing Instructions