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

Link color doesn't work anymore in 10.1.0 #29535

Closed
BKnapen opened this issue Mar 3, 2021 · 10 comments · Fixed by #30452
Closed

Link color doesn't work anymore in 10.1.0 #29535

BKnapen opened this issue Mar 3, 2021 · 10 comments · Fixed by #30452
Assignees
Labels
[Block] Paragraph Affects the Paragraph Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@BKnapen
Copy link

BKnapen commented Mar 3, 2021

Setting the "Link color" in the paragraph block editer doesn't work anymore.! prevous versions links color was working since 10.1.0 not any more.

@annezazu annezazu added [Block] Paragraph Affects the Paragraph Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Needs Testing Needs further testing to be confirmed. labels Mar 3, 2021
@annezazu
Copy link
Contributor

annezazu commented Mar 3, 2021

@BKnapen thanks for reporting this! I tried to replicate by adding a paragraph, adding a link, and then changing the color. I found I was able to do so. Can you provide exact replication steps to reproduce this as well as any screenshots or videos showing the issue? Thanks in advance!

@annezazu annezazu added [Status] Needs More Info Follow-up required in order to be actionable. and removed Needs Testing Needs further testing to be confirmed. labels Mar 3, 2021
@carolinan
Copy link
Contributor

carolinan commented Mar 8, 2021

In a traditional/PHP based theme with add_theme_support( 'experimental-link-color' ); ,
the link color option is available, but the selected color is not applied in the editor or the front.
I tested in a few default themes by adding the theme support. (Twenty Twenty-One also has support for this feature)

When I activate an FSE theme, TT1 Blocks and try the link color option in the post editor, the link color option works because a color is assigned to
--wp--style--color--link

Gutenberg Version 10.1.1 and current trunk 7047eac

WordPress 5.7-RC3-50503
Windows 10
Chrome version 88.0.4324.190

@carolinan carolinan added the [Type] Bug An existing feature does not function as intended label Mar 8, 2021
@youknowriad
Copy link
Contributor

@nosolosw do you know what changed recently that might have impacted this?

@oandregal
Copy link
Member

oandregal commented Mar 9, 2021

It looks like this goes back to 9.6 (December 22) when the logic was updated to not enqueue the Global Styles CSS if the theme declared theme.json ― which includes the colors as CSS vars, a requirement for the link color feature to work.

I see two paths forward here:

  1. We don't enqueue any CSS for themes without theme.json support => the link color feature should be disabled for these themes.
  2. We enqueue the presets declared by the theme as CSS variables for themes without theme.json support => the link color can still work for them.

I remember that change aimed to address reports of theme authors in core-editor that found it weird that their themes would have some CSS they can't control and can conflict with its own CSS. I presume that rationale is still valid so I'd go with 1.

@github-actions
Copy link

Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Mar 25, 2021
@carolinan
Copy link
Contributor

This is a theme support add_theme_support( 'experimental-link-color' ); expected to work without a JSON file.
So I don't think we can go with 1?

@carolinan
Copy link
Contributor

Can't we add a color for the variable in the theme support? I mean similar to the color palette.

@oandregal oandregal removed [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. labels Mar 25, 2021
@oandregal
Copy link
Member

In #29891 we're converting the link to an element ― it'll be no longer a simple color for links, it'll be able to have many more things (color background, typography, etc).

Additionally, add_theme_supports('experimental-link-color') only works with the plugin active and is experimental. I'm thinking that the path forward should be removing the add_theme_supports('expelimental-link-color') a couple of releases after the elements PR lands and embrace the fact that the link API is tied to theme.json.

@youknowriad
Copy link
Contributor

So I've checked this a bit as well and for me it seems the solution is as simple as adding:

a {
color: var(--wp--style--color--link, blue ); // blue is the default color here 
}

to your theme's stylesheet. I think that's a decent fix for an experimental API. Am I missing something?

@youknowriad
Copy link
Contributor

youknowriad commented Apr 1, 2021

Oh I guess the presets styles are not generated anymore. For me this should be fixed and presets styles (CSS variables or not) should be generated properly regardless of how the theme is providing them. (theme.json or theme support flag)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Paragraph Affects the Paragraph Block [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants