Skip to content
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

Clicking Wide or Full alignment makes the Image block jump #12292

Closed
afercia opened this issue Nov 25, 2018 · 3 comments · Fixed by #12305
Closed

Clicking Wide or Full alignment makes the Image block jump #12292

afercia opened this issue Nov 25, 2018 · 3 comments · Fixed by #12305
Labels
[Type] Bug An existing feature does not function as intended

Comments

@afercia
Copy link
Contributor

afercia commented Nov 25, 2018

Tested with Twenty Nineteen because it supports "Wide" or "Full" alignments.

When clicking the "Wide" or "Full" alignment buttons in an Image block, the image "jumps" a bit down, even though there's no apparent reason for the extra space to exist. Here's a GIF:

wide

This seems to happen only on the Image block. Doesn't happen on other blocks that support wide and full alignment, e.g. Columns, Cover, Gallery.

As far as I can tell, the jump is caused by one single line of CSS: position: relative here:

&[data-align="wide"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar,
&[data-align="full"] > .editor-block-list__block-edit > .editor-block-contextual-toolbar {
width: calc(100% + #{ $block-padding * 2 + $border-width * 2 }); // Matches the negative margins applied to parent blocks.
height: 0; // This collapses the container to an invisible element without margin.
text-align: center;
.editor-block-toolbar {
max-width: $content-width;
width: 100%;
position: relative;

To my understanding, especially after #7365, the toolbar should be completely pulled out from the layout flow. That's the reason why it normally uses position: absolute.

However, with a wide or full alignment, it gets position: relative; so it still takes some space in the layout.

Pushing a PR to remove position: relative; would be trivial and in my testing it would fix the issue. However, I'm not sure if there are other reasons for position: relative;. /Cc @jasmussen

@afercia afercia added the [Type] Bug An existing feature does not function as intended label Nov 25, 2018
@jasmussen
Copy link
Contributor

Thanks for a very solid ticket with even a suggested fix.

However that fix won't do it. When removing the position relative, this happens:

sans-position-relative

Due to the change we recently made to TwentyNineteen this wasn't easily discoverable, but as you ticketed yourself in WordPress/twentynineteen#665 that behavior might need a revisit. Basically we need the block movers to be available also for fullwide images.

I will see if I can find another fix.

jasmussen pushed a commit that referenced this issue Nov 26, 2018
Fixes #12292.

This PR fixes an issue where the block toolbar would cause an image to jump downwards when the wide or fullwide buttons were pressed.

Recently as part of a floats refactor, we also refactored how the block toolbar worked. This meant the removal of a floats rule to the toolbar itself, because it was both unnecessary and interfered with adjacent floats. This PR restores that rule, but for wide and fullwide only, fixing the regression.
@afercia
Copy link
Contributor Author

afercia commented Nov 26, 2018

Ah, I see, that's with Twenty Seventeen and the toolbar docked to the block left edge. Right.

@jasmussen
Copy link
Contributor

Submitted fix in #12305.

youknowriad pushed a commit that referenced this issue Nov 26, 2018
Fixes #12292.

This PR fixes an issue where the block toolbar would cause an image to jump downwards when the wide or fullwide buttons were pressed.

Recently as part of a floats refactor, we also refactored how the block toolbar worked. This meant the removal of a floats rule to the toolbar itself, because it was both unnecessary and interfered with adjacent floats. This PR restores that rule, but for wide and fullwide only, fixing the regression.
youknowriad pushed a commit that referenced this issue Nov 29, 2018
Fixes #12292.

This PR fixes an issue where the block toolbar would cause an image to jump downwards when the wide or fullwide buttons were pressed.

Recently as part of a floats refactor, we also refactored how the block toolbar worked. This meant the removal of a floats rule to the toolbar itself, because it was both unnecessary and interfered with adjacent floats. This PR restores that rule, but for wide and fullwide only, fixing the regression.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants