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

Quote Block: styles are different between front end and editor #45547

Open
mikachan opened this issue Nov 4, 2022 · 11 comments
Open

Quote Block: styles are different between front end and editor #45547

mikachan opened this issue Nov 4, 2022 · 11 comments
Labels
[Block] Quote Affects the Quote Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended

Comments

@mikachan
Copy link
Member

mikachan commented Nov 4, 2022

Description

The default styles of the quote block are different between the editor and the front end:

Editor Front end
image image

Text alignment examples:

Editor Front end
image image

Step-by-step reproduction instructions

  1. Insert a quote block
  2. Try left, right and center alignments
  3. Compare the editor and front end views

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

@mikachan mikachan added [Type] Bug An existing feature does not function as intended [Block] Quote Affects the Quote Block labels Nov 4, 2022
@carolinan
Copy link
Contributor

Hi @mikachan & @NidhiDhandhukiya74
I tested this with and without Gutenberg version 15 active.

With Gutenberg active:
In TT3: the border is not visible on the front or in the editor.
In "Empty theme", a border is visible both in the editor and the front.

Do you think this issue might already be solved but is an issue with TT3 theme.json?
Related core trac issue 57506

@mikachan
Copy link
Member Author

I can't test just at the moment but I have a feeling this is related to there not being a functions.php file in TT3, or maybe more specifically that there is no available logic to enqueue editor styles. i.e. TT3 is missing something like the following code:

if ( ! function_exists( 'emptytheme_support' ) ) :
	function emptytheme_support()  {

		// Enqueue editor styles.
		add_editor_style( 'style.css' );
	}
	add_action( 'after_setup_theme', 'emptytheme_support' );
endif;

I think this may have a similar underlying issue to what I was exploring here (there is a similar issue with the separator block being different on the front end and editor): #45351

@carolinan
Copy link
Contributor

Then the style should show on the front when Gutenberg is active, no?

@Pathan-Amaankhan
Copy link

Pathan-Amaankhan commented Jan 19, 2023

Hello @carolinan @mikachan,

These issues are caused because our TT3 theme is missing support for block styles. i.e. wp-block-styles.

Before After adding wp-block-styles support
Screenshot 2023-01-19 at 6 25 07 PM Screenshot 2023-01-19 at 6 25 36 PM
Before After adding wp-block-styles support
Screenshot 2023-01-19 at 6 38 51 PM Screenshot 2023-01-19 at 6 39 08 PM

This also fixes the bug with Separator block mentioned in #45351.

Before After adding wp-block-styles support
Screenshot 2023-01-19 at 7 22 32 PM Screenshot 2023-01-19 at 7 22 55 PM

Have created & added a patch in https://core.trac.wordpress.org/ticket/57506.

Please let me know if I can create PR for the same.

Please forgive me if I have made any mistakes as this is my first contribution.

@carolinan
Copy link
Contributor

The block styles have been left out on purpose during development of this theme, they do not only add styles to the quote block.

@mikachan
Copy link
Member Author

Then the style should show on the front when Gutenberg is active, no?

Ah yeah... in this case, it's the editor styles that are correct, not the front end.

If we update the styles in theme.json to this:

"core/quote": {
  "border": {
    "width": "0 0 0 1px",
    "style": "solid",
    "color": "initial"
},

Then every quote block will have a left border, which doesn't look the best for the centered and right-aligned versions. Perhaps we need a way to style the different alignments via theme.json.

@carolinan
Copy link
Contributor

carolinan commented Jan 20, 2023

I think the block should have a border option that allows the user to remove or add it even if they center the block.
As in, enable the block support:
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/quote/block.json#L30
It will make the pull quote obsolete though.

@mikachan
Copy link
Member Author

I think the block should have a border option that allows the user to remove or add it even if they center the block.

This sounds like a good idea. And I don't think making the pull quote obsolete is a bad thing, as long as users can still achieve the same thing.

@carolinan
Copy link
Contributor

@NidhiDhandhukiya74 @Pathan-Amaankhan Is that something you would like to work on?

@Pathan-Amaankhan
Copy link

@carolinan Sure,
Can I add the toggle boder option to our quote block?

Just had a few questions before starting.

  1. We are going to keep the styles similar to the TT2 theme? i.e.

Screenshot 2023-01-20 at 6 45 51 PM

  1. When the block is aligned center, at what position (left or right) we are going to keep our border?

cc: @mikachan

@carolinan
Copy link
Contributor

carolinan commented Jan 23, 2023

By adding the support for border controls, the users themselves will decide where they want the border, and the default border can be kept to the left.

Support for borders first need to be added to block.json.
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/quote/block.json#L30
We need to decide which of the border controls that should be visible by default.
I think it may be best for it to match the pull quote? I would suggest copying the code from there:
https://github.com/WordPress/gutenberg/blob/trunk/packages/block-library/src/pullquote/block.json#L53

After that, we need to test that the border style options work in the editors and when added in theme.json.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Quote Affects the Quote Block [Feature] Themes Questions or issues with incorporating or styling blocks in a theme. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants