Navigation Link Block Color is overriden by block CSS
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
On Hover State
Step-by-step reproduction instructions
- Create a Block Theme and mention the navigation link rule for hover and normal state
- Add a link to Navigation block in post/page
- 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
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.
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.
Apologies for the delay, I tried targetting page-list and it was of no help.
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" }
}
}
}
},
#47431 seems to be related. I commented a summary there. Should these issue be merged?
Thanks @gaambo, a bit late, but I'll close this issue as a duplicate of the original you mentioned.