Opened 2 years ago
Closed 2 years ago
#56173 closed defect (bug) (fixed)
Twenty Twenty-One: Separator block is having issue in editor site with background color for default and thick style.
Reported by: | nidhidhandhukiya | Owned by: | |
---|---|---|---|
Milestone: | 6.1 | Priority: | normal |
Severity: | normal | Version: | 6.0 |
Component: | Bundled Theme | Keywords: | has-patch needs-testing |
Focuses: | Cc: |
Description
Steps to reproduce:-
- Activate the Twenty Twenty-one theme.
- Select separator block.
- From styles choose default or thick and change the background colour.
- You can see your background colour is applicable but not visible properly.
For better understanding, I have attached a video.
Video URL:- https://share.cleanshot.com/TuBXQrDN3D1e3mr24hUF
Attachments (2)
Change History (12)
#2
@
2 years ago
- Milestone changed from Awaiting Review to 6.1
- Summary changed from Twenty Twenty one Separator block is having issue in editor site with background color for default and thick style. to Twenty Twenty-One: Separator block is having issue in editor site with background color for default and thick style.
Hi there!
Thanks for the ticket and patch.
Your approach works fine but I don't think it needed border-bottom-color: inherit;
just remove border-color
from CSS that's fine.
I have another approach to solve it. Will submit PR for it.
cc. @poena
Moving to 6.1
consideration.
This ticket was mentioned in PR #2961 on WordPress/wordpress-develop by mukeshpanchal27.
2 years ago
#3
Trac ticket: https://core.trac.wordpress.org/ticket/56173
#4
@
2 years ago
This approach will break theme styles for anyone who has added a custom color to the existing custom CSS property.
I honestly do not know what the best way forward is.
#7
@
2 years ago
Hello @mukesh27
Yes you are right we don't need
border-bottom-color: inherit;
it is working if we removed the colour from the border-bottom as per your comment I have do this change and checked in my local yes it is working with this approach.
Submitted updated patch for this solution.
#8
@
2 years ago
Hi
Removing var(--separator--border-color);
this way will break the block for existing sites
that has added a color to this custom CSS property.
I agree that selecting a color for the block must replace the CSS custom property.
The property needs to be applied so that the default color shows correctly if someone does not select a color.
When we select a color, the editor adds the .has-text-color
CSS class to the block.
-By targeting this class, the CSS property can be removed when the color is replaced, and still work when it is needed.
It looks like the class that the theme used to solve this problem has changed. The theme used
.has-background
and now only .has-text-color
is used on the block.
What a strange change for a background color option!
Markup in 5.3:
<hr class="wp-block-separator has-text-color has-alpha-channel-opacity has-background is-style-twentytwentyone-separator-thick" style="background-color:#cb0202;color:#cb0202">
Markup in 6.0:
<hr class="block-editor-block-list__block wp-block has-text-color has-alpha-channel-opacity is-selected wp-block-separator is-style-twentytwentyone-separator-thick" id="block-fce4da68-baa3-4ba9-9245-9694975df6be" tabindex="0" role="document" aria-label="Block: Separator" data-block="fce4da68-baa3-4ba9-9245-9694975df6be" data-type="core/separator" data-title="Separator" style="color: rgb(229, 0, 103); background-color: rgb(229, 0, 103);">
Please see line 42, .has-text-color
should be added to this list:
https://core.trac.wordpress.org/browser/trunk/src/wp-content/themes/twentytwentyone/assets/sass/05-blocks/separator/_editor.scss#L42
#9
@
2 years ago
I have made a pull request upstreams in Gutenberg that will re-add the missing class to the block: https://github.com/WordPress/gutenberg/pull/42769
#10
@
2 years ago
@nidhidhandhukiya Hi! Pinging you to ask if you are able to test if you can reproduce the problem in WordPress 6.1 alpha or the upcoming beta. According to my own testing, it has been solved.
But do we consider it enough if this issue is fixed in WordPress 6.1, or do we need to solve it for 6.0 in the theme?
After applying this solution when we run this command
then the changes will be reflected and issue is resolved.