WordPress / wporg-parent-2021

21 stars 11 forks source link

Link styling is no longer being reflected accurately due to specificity changes in Gutenberg #143

Closed ndiego closed 5 months ago

ndiego commented 5 months ago

Moving this over from https://github.com/WordPress/wporg-mu-plugins/issues/627

I noticed this today when testing the Theme Directory refresh, but this impacts all newly redesigned sites with the local navigation bar.

Unlike the links on the right, the main link back to the site homepage is not underlined on hover, which makes it hard to tell that it's actually a link. Here's an example in Developer Resources.

https://github.com/WordPress/wporg-mu-plugins/assets/4832319/e42f3d5a-13d2-45c4-aab5-86a1d8f34ab8

@ryelle mentioned:

I think this has to do with GB's restructuring of CSS specificity for styles generated from theme.json. The generated CSS rule for hover :root :where(.wp-block-site-title a:where(:not(.wp-element-button)):hover) is no longer overriding the default general a:hover provided by the parent theme.

Maybe we can move this bit of CSS to a rule in theme.json to ensure the styles cascade correctly?

One potential solution might be to apply a link element style in theme.json, something like:

"elements": {
    "link": {
        "typography": {
            "textDecoration": "none"
        },
        ":hover": {
            "typography": {
                "textDecoration": "underline"
            }
        }
    }
}