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 styling is no longer being reflected accurately due to specificity changes in Gutenberg #143

Closed
ndiego opened this issue Jun 17, 2024 · 0 comments
Assignees
Labels
Accessibility Issues related to keyboard navigation, screen readers, etc [Component] Theme Templates, patterns, CSS [Type] Bug Something isn't working

Comments

@ndiego
Copy link
Member

ndiego commented Jun 17, 2024

Moving this over from WordPress/wporg-mu-plugins#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.

local-nav-link.mp4

@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"
            }
        }
    }
}
@ndiego ndiego added [Type] Bug Something isn't working [Component] Theme Templates, patterns, CSS labels Jun 17, 2024
@ryelle ryelle added the Accessibility Issues related to keyboard navigation, screen readers, etc label Jun 17, 2024
@ryelle ryelle self-assigned this Jun 18, 2024
@ryelle ryelle closed this as completed in 3b02a3b Jun 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Accessibility Issues related to keyboard navigation, screen readers, etc [Component] Theme Templates, patterns, CSS [Type] Bug Something isn't working
2 participants