Make WordPress Core

Opened 16 months ago

Last modified 9 days ago

#55974 new defect (bug)

Theme-specific border color options for Pullquote block

Reported by: kajalgohel's profile kajalgohel Owned by:
Milestone: 6.4 Priority: normal
Severity: normal Version: 6.0
Component: Bundled Theme Keywords: has-patch needs-testing
Focuses: ui, css Cc:

Description

In Twenty Twenty Theme, when we add Pullquote block in editor side and add any border style after that choose border color, We can see that border color is seen in editor side. But when we see the same Pullquote block at front side, border color is not reflected.

Steps to replicate:
1: Activate the Twenty Twenty Theme
2: Add Pullquote block
3: Add border style
4: choose border color
5: Save Page/Post
6: View the page/post at front side

For better understanding I provide video attachment link.
Video URL : https://share.cleanshot.com/bqZzSHG6AGVy2hslSIqc

Thanks

Attachments (1)

twenty_nineteen_pullquote_border_2023_09_23.mp4 (1.8 MB) - added by poena 9 days ago.
In the video I am adding the blue color to the pullqoute block, but in the border color setting, this color is *not* called primary which may be a bug.

Download all attachments as: .zip

Change History (35)

#1 @sabernhardt
16 months ago

  • Summary changed from Twenty Twenty: border color issue in Pullquote block to Theme-specific border color options for Pullquote block

Out of all the bundled themes, only Twenty Twenty-Two and Twenty Seventeen show border colors from preset selections. Twenty Twenty-Two defines border colors based on global styles, and Twenty Seventeen uses the default options instead of making its own color palette.

And Twenty Nineteen specifically sets the pullquote block border color to transparent:

.entry .entry-content .wp-block-pullquote {
  border-color: transparent;
}

(If you create a custom color, though, that applies to the block as an inline style.)

This ticket was mentioned in PR #2944 on WordPress/wordpress-develop by adamwoodnz.


15 months ago
#2

  • Keywords has-patch added; needs-patch removed

This PR fixes issues in the bundled themes with block border colors, in particular the Pullquote block. In Twenty Twenty One, Twenty Twenty and Twenty Nineteen themes when a border color is set for this block, it is either not applied in the editor or the frontend, or both.

Trac ticket: https://core.trac.wordpress.org/ticket/55974

Testing
For each of the themes Twenty Twenty One, Twenty Twenty and Twenty Nineteen:

Default colors

  1. Create a post with a Pullquote block
  2. Set the border color of the Pullquote using the block options
  3. Ensure the border color is displayed in the editor
  4. Publish the post and ensure the border color is displayed in the frontend
  5. Repeat for each of the available default color options

Custom colors

  1. Go to the theme customizer and customize any of colors allowed by the theme
  2. Return to your post and check that both the editor and the published post use the custom color

This ticket was mentioned in Slack in #core-themes by adamwood. View the logs.


15 months ago

#4 @sabernhardt
15 months ago

  • Milestone changed from Awaiting Review to 6.1

#5 @sabernhardt
13 months ago

  • Milestone changed from 6.1 to Future Release

#6 @adamwood
10 months ago

#57339 was marked as a duplicate.

#7 @adamwood
10 months ago

#57338 was marked as a duplicate.

#8 @adamwood
7 months ago

Retested with 6.2, state is the same:

Twenty Twenty Three

  • Supports both preset colors and custom colors in editor and frontend. No fixes required.

Twenty Twenty Two

  • Supports both preset colors and custom colors in editor and frontend. No fixes required.

Twenty Twenty One

  • Supports custom colors in editor and frontend
  • Supports preset colors (doesn't allow customizer) in editor but not frontend

Twenty Twenty

  • Supports custom colors in editor and frontend
  • Supports preset colors (including customizer set) in editor but not frontend

Twenty Nineteen

  • Supports custom colors in editor and frontend
  • Supports preset colors (including customizer set) in editor but not frontend

Twenty Seventeen

  • Supports both preset colors and custom colors in editor and frontend. No fixes required.

Twenty Sixteen

  • Supports custom colors in editor and frontend
  • Supports preset colors in editor but not frontend

Twenty Fifteen

  • Supports custom colors in editor and frontend
  • Supports preset colors in editor but not frontend

#9 @SergeyBiryukov
7 months ago

  • Milestone changed from Future Release to 6.2

Thanks for the refreshed PR! Moving to 6.2 for visibility.

#10 @poena
7 months ago

  • Keywords needs-refresh added

Hi!
I added some notes on the PR.

Twenty Twenty-One changes the foreground color depending on the dark mode and background color settings. This functionality should be updated to work for the border, but it can be done in a separate ticket once classic themes fully support the border controls for blocks.

#11 @poena
7 months ago

  • Milestone changed from 6.2 to Future Release

#12 @poena
7 months ago

Sergey, I moved it to future release again since the PR needs to be updated, and we are already at beta 3.

#13 @adamwood
3 months ago

#58624 was marked as a duplicate.

@poena commented on PR #2944:


2 months ago
#14

Thank you for continuing the work on this feature.
I want to add the from WordPress 6.3, themes can opt-in to the block border support with: add_theme_support( 'border' );
I think the default themes should use this theme support.

The CSS changes are still needed. I have opened a related issue in the Gutenberg GitHbu repo:
https://github.com/WordPress/gutenberg/issues/52864

@adamwood commented on PR #2944:


2 months ago
#15

You're welcome!

I want to add that from WordPress 6.3, themes can opt-in to the block border support with: add_theme_support( 'border' );
I think the default themes (non block themes) should use this theme support.

To be clear; do you mean there is more work to do in this PR?

@poena commented on PR #2944:


2 months ago
#16

Yes I think the theme support should be added to the functions.php files setup functions. Otherwise the user can not take full advantage of the CSS border changes?

@adamwood commented on PR #2944:


2 months ago
#17

Otherwise the user can not take full advantage of the CSS border changes?

So that will mean that any block added in these themes will now get border controls? How far back do you think we should add this support.. beyond twentynineteen?

@adamwood commented on PR #2944:


2 months ago
#18

So will that mean that any block that supports border added in these themes, will now get border controls displayed?

Ah yes I can see this working after adding it.

@poena commented on PR #2944:


2 months ago
#19

Lets start with these 3 themes because the PR has the potential to grow too big.

@adamwood commented on PR #2944:


2 months ago
#20

Discovered that twentytwenty actually has border styles off for the pullquote block. It seems that the fix should be to disable the controls in that scenario. Or we could allow it by changing the styles to something like:

.editor-styles-wrapper .wp-block-pullquote {
        color: inherit;
        position: relative;
        text-align: center;
}

.editor-styles-wrapper .wp-block-pullquote:not(.has-border-color):not([style*=border-width]) {
        border: none;
        padding: 0;
}

Thoughts @carolinan ?

@adamwood commented on PR #2944:


2 months ago
#21

Discovered that twentytwenty actually has border styles off for the pullquote block. It seems that the fix should be to disable the controls in that scenario.

I was wrong this was only in the editor. Added a fix to add editor support. Haven't addressed padding.

@adamwood commented on PR #2944:


2 months ago
#22

I've now tested the 3 themes with pullquote and group blocks, including changing colors with customizer and custom block colors, and I believe all are working as expected. Are there any other blocks in particular that you think warrant testing?

@adamwood commented on PR #2944:


2 months ago
#23

These E2E tests seem very flaky; failures due to TimeoutError: Navigation timeout of 30000 ms exceeded seem very common on https://github.com/WordPress/wordpress-develop/actions/workflows/end-to-end-tests.yml

@adamwood commented on PR #2944:


4 weeks ago
#24

I've just rebased again @carolinan, are you able to give this another review please? Pretty keen to get this wrapped up 🙂

#25 @poena
4 weeks ago

  • Keywords needs-testing added; needs-refresh removed
  • Milestone changed from Future Release to 6.4

#26 @poena
4 weeks ago

The following blocks support border:
Avatar
Button
Code
Column
Columns
Comments Title
Group
Image
Post Featured Image
Pullquote
Read More
Search
Table
Verse

Twenty Nineteen testing results

Open a terminal in the theme folder. Use the commands to build the CSS:
npm install
npm run build

Pullquote test:
Custom color selected with the color picker works well.

  • Default color settings in customizer works well.
  • When I change the color in the customizer option:
    • The color palette in the actual setting in the editor is correctly updated.
    • Blocks that had the primary color applied does not update to the new color. The old color is added inline without using the CSS class name.
    • Blocks that had the secondary color applied does update to the new color. The new color is added with the help of the CSS class name.

#27 @poena
4 weeks ago

Twenty Twenty testing results

Pullquote test:
Custom colors selected with the color picker work well.
Colors from the theme palette (the default color settings in the customizer) work well.
When I change the colors in the customizer options, the colors work well.

#28 @poena
4 weeks ago

Twenty Twenty-One testing results

Open a terminal in the theme folder. Use the commands to build the CSS:
npm install
npm run build

I tested the pull quote with:

  • the default background color,
  • dark mode enabled.
  • custom background color selected in the customizer.

Colors from the color picker work well
Colors from the palette work well

Last edited 4 weeks ago by poena (previous) (diff)

#29 @adamwood
4 weeks ago

Thanks @poena! So is this Twenty Nineteen issue the only defect?

Blocks that had the primary color applied does not update to the new color. The old color is added inline without using the CSS class name.

Last edited 4 weeks ago by adamwood (previous) (diff)

#30 follow-up: @poena
4 weeks ago

Yes, but I only tested one block.

#31 @poena
4 weeks ago

#58618 was marked as a duplicate.

#33 in reply to: ↑ 30 @adamwood
4 weeks ago

Replying to poena:

Yes, but I only tested one block.

I can't reproduce this unfortunately, maybe I'm missing something.

Here's the behaviour I see:

https://cldup.com/0dXDhjysKh.gif

The color is applied via the [code from functions.php](https://github.com/WordPress/wordpress-develop/pull/2944/files#diff-56ba742c278e04ff8ab72489847c46915c2c4ae6d6a247a46dca81950bfdeb18L159)

https://cldup.com/E7-fxHZz-R.jpg

Please let me know if I'm testing this wrong.

@poena
9 days ago

In the video I am adding the blue color to the pullqoute block, but in the border color setting, this color is *not* called primary which may be a bug.

#34 @poena
9 days ago

In the video, I am doing the following:

I select a pullquote block in the block editor and add a border width, border color, and border-radius.

When I select the first color in the color palette, the palette does not actually use the name or label "primary", which I would expect.
Visually, the border is applied correctly in the editor.

I save the post and view the block on the front. Visually, the border is applied correctly.
I open the customizer, select the color panel, and change the primary color to "custom".
I adjust the slider in the color selector, but the border color does not change.
Now, I am thinking that maybe I need to publish the changes for them to work, so I press the publish button in the customizer.
Nothing changes; the border stays the same color.
I try a few more colors, and then I scroll down the page and see that a link color has been changed, so the color has been updated, just not for the pullquote border.

I close the customizer and return to editing the post.
I confirm that the color palette in the block color setting has been updated.
I hover over the color palette and notice that the color is still not labeled "Primary".

I open the code editor mode in the block editor and find that the color referenced uses a hex code.
I close the code editor mode and change the border color to the first color in the palette.
Then I open the code editor mode again and find that the color referenced is "primary".

<!-- wp:pullquote {"style":{"border":{"radius":"30px","width":"20px"}},"borderColor":"primary"} -->
<figure class="wp-block-pullquote has-border-color has-primary-border-color" style="border-width:20px;border-radius:30px">
Note: See TracTickets for help on using tickets.