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

Alignment class not used in Editor #18644

Closed
billbellon opened this issue Nov 20, 2019 · 4 comments
Closed

Alignment class not used in Editor #18644

billbellon opened this issue Nov 20, 2019 · 4 comments
Labels
[Type] Enhancement A suggestion for improvement.

Comments

@billbellon
Copy link

When changing the alignment of a Pullquote Block in the Editor, neither the WordPress alignright or alignleft class are added. If a custom Block Style is being used that customizes the align left/right state of the Pullquote Block, that customization is only seen when viewing the Post/Page, not when editing it.

To reproduce:

  1. Create a new Post
  2. add a Pullquote Block
  3. change the alignment to Align Right
  4. Using your browser's developer tools, Inspect the Pullquote Block in the Editor - you won't see the alignright class applied to the <figure> element for the Pullquote Block.

Expected behavior
I expect the Pullquote Block in the Editor to use the same custom Block Style rules as when the Post or Page is viewed. I expect the alignright or alignleft class to be added to <figure>, as is done when the Post/Page is viewed.

Additional context
I am using the latest version of WordPress, version 5.3 with Gutenberg.

@jorgefilipecosta
Copy link
Member

Hi @ssecweb, this behavior seems to not just happen on Pullquote. Blocks like image and button also don't contain the alignment classes on the editor. I agree that this difference between editor and frontend makes things harder to style.

@jorgefilipecosta jorgefilipecosta added the [Type] Enhancement A suggestion for improvement. label Nov 21, 2019
@talldan talldan changed the title Pullquote Block - alignment class not used in Editor Alignment class not used in Editor Feb 4, 2020
@talldan
Copy link
Contributor

talldan commented Feb 4, 2020

I've closed #19331, which also mentions that classnames for alignment aren't applied in the editor, cc @strarsis who wrote the following:


Describe the bug
alignfull and alignwide alignment options are not reflected by the block classes in editor.
These classes are only applied to their element counterparts in frontend.
Edit: Even worse, manually added classes alignfull and alignwide are automatically removed when saving.

To reproduce
Steps to reproduce the behavior:

  1. Add align-wide theme support.
  2. Add group element in Gutenberg editor.
  3. Select full or wide alignment option for that group element.
  4. Inspect the group element in editor and notice that it gets no class for alignfull or alignwide assigned to it, on frontend however the class is assigned to the element for that block.
    The element is still somehow styled by the editor (inline) to become somehow wide or full aligned, but the theme can't optimize or change this process using the appropriate classes for CSS.

Expected behavior
alignfull and alignwide classes are correctly applied to block elements in editor as they are already in frontend, too. Edit: And that these classes alignfull and alignwide aren't removed automatically during editor save.

@youknowriad
Copy link
Contributor

In #20650 we're trying to rethink alignments and hopefully bring consistency across blocks in the editor and the frontend.

@ghost
Copy link

ghost commented Sep 28, 2021

This is severely irritating for providing a good editor experience.

This needs to be re-opened, and these classes need to be applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

4 participants