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

Block toolbar position broken for full-wide blocks in some themes. #14588

Closed
kjellr opened this issue Mar 22, 2019 · 3 comments
Closed

Block toolbar position broken for full-wide blocks in some themes. #14588

kjellr opened this issue Mar 22, 2019 · 3 comments
Labels
General Interface Parts of the UI which don't fall neatly under other labels. Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.

Comments

@kjellr
Copy link
Contributor

kjellr commented Mar 22, 2019

This could end up being a Twenty Nineteen issue, but since it popped up recently (and nothing has changed in Twenty Nineteen), I figured I'd start here.

Lately, I've noticed that the block toolbar for full-aligned blocks appears cut off on mobile when using Twenty Nineteen:

2019

There's also a bit of toolbar misplacement when editing the children of the cover image block on mobile:

Screen Shot 2019-03-22 at 4 04 30 PM

There have been no recent updates to Twenty Nineteen's editor styles, so my guess is that this is due to a recent change in Gutenberg. It could theoretically be fixed by setting the .block-editor-block-contextual-toolbar position to left: 0 and right: 0 in Twenty Nineteen's editor styles, but this sort of editor UI adjustment doesn't seem like the sort of thing theme styles should mess with.

This exact issue does not appear in other themes, however a very similar issue appears if you view a full-wide image block in other Twenty- themes:

Artboard

(Note, these themes do not declare full/wide block support, so to reproduce you need to create a full-aligned block in a different theme and then switch to these themes to view the error).

@kjellr kjellr added [Type] Bug An existing feature does not function as intended General Interface Parts of the UI which don't fall neatly under other labels. [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes. Needs Testing Needs further testing to be confirmed. labels Mar 22, 2019
@kjellr kjellr changed the title Block toolbar position broken for full-wide blocks some themes. Block toolbar position broken for full-wide blocks in some themes. Mar 22, 2019
@m-e-h
Copy link
Member

m-e-h commented Mar 24, 2019

I've experienced something similar. Pretty sure it has to do with the method the theme uses to align it's blocks and a full-width block. I recently switched from doing a margin-left: calc(-50vw + 50%); kind of thing to using flexbox and the issue disappeared for me.

Actually, the toolbar is now centered on align-full blocks but it's better than it was. I'll try to take a deeper look sometime this week.

@m-e-h
Copy link
Member

m-e-h commented Mar 25, 2019

My similar issue above must've been something I did cause I can't seem to replicate it. 😕

The issue you're seeing @kjellr I'm able to replicate on any theme that supports the full width.

Here's an unmodified underscores theme at < 600px:

fullwidth

It could theoretically be fixed by setting the .block-editor-block-contextual-toolbar position to left: 0 and right: 0

That's exactly where I see the issue too.
This does get done at > 600px:

@media (min-width: 600px) {
	.block-editor-block-list__block .block-editor-block-contextual-toolbar {
		left: auto;
		right: auto;
	}
}

https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/block-list/style.scss#L917-L920

I'm not seeing where we ever need that -14px on the .block-editor-block-contextual-toolbar itself. At least not with [data-align="full"].
https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/block-list/style.scss#L833-L843

The 14px padding is already compensated for on the contextual-toolbar's parent div:

.block-editor-block-list__layout .block-editor-block-list__block[data-align="full"] > .block-editor-block-list__block-edit {
    margin-left: -14px;
    margin-right: -14px;
}

https://github.com/WordPress/gutenberg/blob/master/packages/block-editor/src/components/block-list/style.scss#L470-L484

What a beast of a file that /block-list/style.scss is, btw. 👹

@kjellr
Copy link
Contributor Author

kjellr commented Mar 27, 2019

The issue you're seeing @kjellr I'm able to replicate on any theme that supports the full width.

Ah yes, I'm seeing it everywhere now too. Opened #14669 as a potential fix. Thanks for the investigation, @m-e-h!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
General Interface Parts of the UI which don't fall neatly under other labels. Needs Testing Needs further testing to be confirmed. [Type] Bug An existing feature does not function as intended [Type] Plugin Interoperability Incompatibilities between a specific plugin and the block editor. Close with workaround notes.
Projects
None yet
Development

No branches or pull requests

2 participants