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

<mark> elements in search results can be invisible in Windows High Contrast Mode #2649

Open
lfdebrux opened this issue Oct 8, 2021 · 0 comments

Comments

@lfdebrux
Copy link
Member

lfdebrux commented Oct 8, 2021

Description of issue

If you use https://www.gov.uk/search with Windows High Contrast Mode (HCM) enabled, your search results will have invisible words.

Screenshot of issue

Affected systems

This happens in Edge, Chrome, and IE11 on Windows, when using Windows HCM with a dark theme.

This doesn't happen in Firefox.

Cause of issue

The finder frontend styles uses <mark> elements to wrap the search query in search results, but styles them to have a transparent background colour:

In forced colour modes such as HCM, the browser will will ignore the CSS colour properties, and use the default colours, except for the alpha value of the background colour 1. This means that the mark will be forced to have a yellow background and black text, except the background will be transparent. With a black background this becomes black text on a black background.

Suggested fix

The tech-docs-gem had a similar issue and fixed it in alphagov/tech-docs-gem#265 by using the CanvasText colour, which is respected in forced colour modes.

Footnotes

  1. https://bugs.chromium.org/p/chromium/issues/detail?id=1253295

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

1 participant