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] Separator - Default and Wide styles look the same in many FSE themes #50674

Open
cuemarie opened this issue May 16, 2023 · 5 comments
Open
Labels
[Block] Separator Affects the Separator Block [Type] Enhancement A suggestion for improvement.

Comments

@cuemarie
Copy link

cuemarie commented May 16, 2023

Description

he Seperator Block has 3 supported styles: Default (narrow line), Wide Line (full width), and Dots (dotted line). On many FSE themes, including Twenty Twenty Three and Blank Canvas, the Default style is identical to the Wide Line style.

Step-by-step reproduction instructions

  1. Activate theme Twenty Twenty Three
  2. In a page or post, add a Separator block
  3. Switch between "Default" and "Wide Line" styles, observe that there's no difference

Screenshots, screen recording, code snippet

Editor

Screen Capture on 2023-05-16 at 10-02-37

Live Site
Markup on 2023-05-16 at 09:51:12

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

@carolinan
Copy link
Contributor

carolinan commented May 19, 2023

This is intentional.
The 100px width limitation for the default variation is only applied if the theme adds theme support for add_theme_support( 'wp-block-styles' )
So each theme can opt-in to using a narrow design for the default, or, they can choose not to.

This width limitation was imposed early on, and made it difficult to style the block and stopped the block alignment options (wide, full width) from working.


In many cases, the best option for new block themes is to remove several of the older style variations, because they don't work very well anymore.

@Sisanu
Copy link
Contributor

Sisanu commented Sep 18, 2023

This is intentional.

This intentional feature does not play nicely with the block alignment. If the block is wide-aligned, the block width should not be overridden with 100px. The 100px overrides the size also when the block is full-aligned.

What am I missing?

For example, this is the expected behavior (which now we do not have anymore because of the 100px override):

Screenshot 2023-09-18 at 16 12 59

Additionally:

The 100px width limitation for the default variation is only applied if the theme adds theme support for add_theme_support( 'wp-block-styles' ) So each theme can opt-in to using a narrow design for the default, or, they can choose not to.

To me, it looks like the condition is not enough, we do want to use styles for many other blocks, not just for the core/separator.

@carolinan
Copy link
Contributor

.wp-block-separator:not(.is-style-wide):not(.is-style-dots){
  width:100px;
}

Should probably be something like

.wp-block-separator:not(.is-style-wide):not(.is-style-dots):not(.alignwide):not(.alignfull){
  width:100px;
}

@Sisanu
Copy link
Contributor

Sisanu commented Sep 19, 2023

Shorter version maybe?

.wp-block-separator:not(.is-style-dots,.is-style-wide,.alignwide,.alignfull){
  width:100px;
}

I will test some more on my end to see if this fixes the alignment.

@Sisanu
Copy link
Contributor

Sisanu commented Sep 19, 2023

I tested some more and there are some styles refactoring in the master branch for this block, the .is-style-wide has been removed.
However, based on the new options, I changed the styles to make the block span as intended, following the rule that instances without wide or full alignment (following the logic, I would incline to think that also .aligncenter to be excluded ?!):
Screenshot 2023-09-19 at 19 01 47
stay restricted to 100px.

The front-end result is as intended:
Screenshot 2023-09-19 at 19 11 14

But, in the process, I discovered that the editor is not picking up the align class, and that should also be fixed
Screenshot 2023-09-19 at 19 07 20


So, if we are to fix this following the logic that only the instances not aligned to stick to 100px, this is the code that would work:

Screenshot 2023-09-19 at 19 20 20

And the result:

  • default
  • dots
  • thick
  • center-aligned
  • wide-aligned
  • full-aligned
Screenshot 2023-09-19 at 19 19 57

Should I assign the task to me and create a PR or does anyone else want it?

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

No branches or pull requests

5 participants