gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Navigation Link Block Color is overriden by block CSS

Open adarshakshatPosimyth opened this issue 2 years ago • 5 comments

Description

Even though color for Hover and text is provided in theme.json "core/navigation": { "spacing": { "blockGap": "0.5rem" }, "elements": { "link": { "typography": { "textDecoration": "none" }, "color": { "text": "var(--wp--preset--color--on-surface)" }, ":hover": { "color": { "text": "var(--wp--preset--color--on-surface-variant)" }, "typography": { "textDecoration": "underline" } } } } The Hover State color is overriden by Css Rule from wp-includes/blocks/navigation/style.min.css Normal State Screenshot 2024-01-03 at 1 37 21 PM On Hover State Screenshot 2024-01-03 at 1 39 46 PM

Step-by-step reproduction instructions

  1. Create a Block Theme and mention the navigation link rule for hover and normal state
  2. Add a link to Navigation block in post/page
  3. View the link in front end and hover over it . Notice Color doesn't change

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

adarshakshatPosimyth avatar Jan 03 '24 08:01 adarshakshatPosimyth

The navigation block links are specific blocks. What I means is that the actual link is not in the block called "core-navigation" but on the inner blocks like the core/navigation-link, core/page-list and so on. So try to move the link styles to those blocks.

carolinan avatar Jan 08 '24 09:01 carolinan

I am removing the needs testing label because I can confirm that this style in theme.json does not work.

It might not be a true "bug", it might be intended?, but it does not work like developers expect it to, and it would be much easier if the style could just be added to core/navigation.

carolinan avatar Jan 08 '24 09:01 carolinan

Apologies for the delay, I tried targetting page-list and it was of no help.

Screenshot 2024-01-20 at 12 17 46 AM

Here's the theme.json

"core/page-list": { "spacing": { "blockGap": "0.5rem" }, "elements": { "link": { "color": { "text": "var(--wp--preset--color--on-surface)" }, ":hover": { "color": { "text": "var(--wp--preset--color--on-surface-variant)" }, "typography": { "textDecoration": "underline" } } } } },

adarshakshatPosimyth avatar Jan 19 '24 18:01 adarshakshatPosimyth

#47431 seems to be related. I commented a summary there. Should these issue be merged?

gaambo avatar Mar 25 '24 14:03 gaambo

Thanks @gaambo, a bit late, but I'll close this issue as a duplicate of the original you mentioned.

talldan avatar Jul 01 '24 04:07 talldan