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

Insufficient contrast on highlighted suggestion #425

Open
techbridgedev opened this issue Jun 18, 2024 · 5 comments
Open

Insufficient contrast on highlighted suggestion #425

techbridgedev opened this issue Jun 18, 2024 · 5 comments

Comments

@techbridgedev
Copy link

The contrast between the background color and text on the highlighted result in the suggestions dropdown is insufficient and fails WCAG recommendations for accessibility.

It's poor in light mode, and unreadable in dark mode.

Please update the module stylesheet to use higher contrast colors for the highlighted result.

@weareoutman
Copy link
Member

You can customize the style as you want, see https://github.com/easyops-cn/docusaurus-search-local?tab=readme-ov-file#custom-styles

@techbridgedev
Copy link
Author

techbridgedev commented Jun 19, 2024

Thanks; I didn't see that. But, please consider shipping with default colors that meet accessibility requirements.

Simply overriding --search-local-highlight-color isn't sufficient because it also affects .hitWrapper mark, which can't be easily overridden because it's a module style.

Instead, I had to use .navbar__search mark to revert the <mark> elements, which need the default color to maintain contrast.

I wound up with, e.g.,

[data-theme='dark'] {

 /** Increase highlight contrast **/
 --search-local-highlight-color: var(--my-custom-highlight-color);

  /** Reset to use default **/
  & .navbar__search mark {
    color: var(--ifm-color-primary);
  }
}

@weareoutman
Copy link
Member

weareoutman commented Jun 25, 2024

What's your actual color setting of --ifm-color-primary? I think maybe you have just set a value to cause the contrast issue.

Edit: could you post a screenshot?

@seezee
Copy link

seezee commented Jun 25, 2024

You are correct that I don't use the default value for --ifm-color-primary; however, I tested the site without my custom value and it still failed the contrast requirements for normal text.

Here are screenshots showing the contrast with the default values:

Screenshot 2024-06-25 at 3 21 45 PM Screenshot 2024-06-25 at 3 21 58 PM

The white text on the blue highlight is too low contrast.

@seezee
Copy link

seezee commented Jun 25, 2024

Screenshot 2024-06-25 at 3 28 59 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants