-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Duplicated data-align attribute #24721
Comments
Edit: What I report in this post was just filed as a separate issue in #25088. I have found the same (WP 5.5.1, default Gutenberg). In addition, I noticed a difference in behaviour between certain non-text blocks that take alignment. I'm hanging it on this issue because I think it is related. With core/image and core/buttons, the editor creates this DOM structure in the editor:
Here, alignment is not duplicated and the alignment is wrapped around the block. It is possible other blocks also follow this pattern For most other blocks (e.g. core/table) the alignment becomes a wrapper inside the block, around inner content, and the data-align attribute is duplicated:
I don't know if this is by design, but it makes it much harder to write CSS for the editor, for three reasons:
I can't say I was happy that alignment was separated out to its own DOM element and I would much prefer it to revert to belonging to element with the data-type attribute, which should be the immediate child of |
I've followed the steps above and I can't reproduce this issue anymore. Thanks for the report. |
Describe the bug
As soon as i choose an alignment option (align-wide, align-full, align-left, align-right, align-center) the gutenberg editor will add two
data-align
attributes. This is a pain for creating a custom theme. Of course, you have many selector options, but it will always end in a DRY problem.And because the
<div class="wp-block" data-align="wide">…</div>
has no other option, it will end at something like this:div:not(.wp-block)[data-align="wide"] { … }
.On Default themes, if i chose align wide, the toolbar will float to the left border, instead of align seamless with the block itself.
To reproduce
Steps to reproduce the behavior:
Expected behavior
I Expect, that the toolbar is aligned with the block, like you see in the "fixed" screenshot.
Screenshots
Without css fix
With css fix
Editor version (please complete the following information):
Desktop (please complete the following information):
Smartphone (please complete the following information):
Not tested.
The text was updated successfully, but these errors were encountered: