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

Separator: Custom gradients disappear #52986

Open
bph opened this issue Jul 26, 2023 · 4 comments
Open

Separator: Custom gradients disappear #52986

bph opened this issue Jul 26, 2023 · 4 comments
Labels
[Block] Separator Affects the Separator Block [Type] Bug An existing feature does not function as intended

Comments

@bph
Copy link
Contributor

bph commented Jul 26, 2023

Description

When changing the background on a separator block, using the solid colors or the presets choices on the Gradient tool, everything works.
But as soon as a user tries to use the sliders in the Gradient tool to modify it, the separator block visually disappears from the Editor as well as the front end.

Step-by-step reproduction instructions

  • Add a separator block to a post or page
  • Change the background color using the gradient tool
  • User the slider of the selected gradient to move gradient hues
  • Save the post and view on front end.

Screenshots, screen recording, code snippet

In this video you can first see that the present gradient works.
The when I try to change the colors it disappears.

separator-gradient.mp4

Environment info

WordPress 6.3-RC2 but I also was able to reproduce on WordPress 6.2.2
Twenty Twenty-Two theme.

Chrome 114.0.5735.248
Firefox Developer Edition: 116.0b7
MacOS 13.3.1

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

@bph bph added [Type] Bug An existing feature does not function as intended [Block] Separator Affects the Separator Block labels Jul 26, 2023
@bph bph moved this to ❓ Triage in WordPress 6.4 Editor Tasks Jul 26, 2023
@annezazu
Copy link
Contributor

annezazu commented Sep 7, 2023

Noting that I can't get the gradient to show up at all (editor or front end) with 6.3.1 with or without GB 16.6 active:

gradient.separator.mov

@justintadlock
Copy link
Contributor

I can confirm that gradient presets are not working in the latest Gutenberg 16.6.

Here's a rough fix for gradient presets (haven't solved custom gradients yet) that I added in my theme stylesheet:

.wp-block-separator.has-background[class*=-gradient] {
	border: none;
	height: 2px;
}

@bph bph moved this from Triage to Needs Dev / Todo in WordPress 6.4 Editor Tasks Sep 8, 2023
@bph bph moved this from Needs Dev / Todo to Punted to 6.5 in WordPress 6.4 Editor Tasks Sep 23, 2023
@bph bph moved this to ❓ Triage in WordPress 6.5 Editor Tasks Nov 23, 2023
@annezazu
Copy link
Contributor

annezazu commented Feb 8, 2024

After a review by core editor triage leads and core editor tech leads, this has been removed from the board for 6.5 consideration.

@justintadlock
Copy link
Contributor

Just revisiting this against WP 6.5/trunk and Gutenberg 17.7 RC1.

Custom gradients don't work at all because the gradient isn't applied to the block markup. The best way for theme authors to fix the UX for their users is to disable custom gradients for the Separator block in theme.json (assuming they have custom gradients enabled globally).

{
	"$schema": "https://schemas.wp.org/trunk/theme.json",
	"version": 2,
	"settings": {
		"blocks": {
			"core/separator": {
				"color": {
					"customGradient": false
				}
			}
		}
	}
}

Theme, default, and user-defined gradients, however, can work because the gradient class is applied to <hr> element. It just needs a bit of CSS:

.wp-block-separator.has-background[class*=-gradient] {
	border: none;
	height: 2px;
}

The height can be whatever you want.

justintadlock added a commit to x3p0-dev/x3p0-ideas that referenced this issue Feb 12, 2024
This doesn't work in WordPress/Gutenberg. See: WordPress/gutenberg#52986
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] Bug An existing feature does not function as intended
Projects
No open projects
Status: Punted to 6.5
Development

No branches or pull requests

3 participants