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

SVGs don't match colour of parent text #162

Closed
gregtyler opened this issue Jun 4, 2021 · 1 comment · Fixed by #360
Closed

SVGs don't match colour of parent text #162

gregtyler opened this issue Jun 4, 2021 · 1 comment · Fixed by #360
Labels
accessibility bug A task that fixes something that isn't working released

Comments

@gregtyler
Copy link
Contributor

Where we use inline SVGs (i.e. Primary navigation with toggle search, Rich text editor and Timeline), the colour of the SVG icons is hard-coded into the SVG files themselves.

This means they don't adapt to the text colour around them changes, which makes the icons disappear in certain visual modes. For example, in Windows High Contrast mode, the background is changed to black and any black icons cannot be seen.

Instead, the SVGs should have the CSS attribute fill: currentColor on them so that they match the surrounding text colour. The individual SVGs will also need to be updated to remove the hard-coded fill colour.

@gregtyler gregtyler added bug A task that fixes something that isn't working accessibility labels Jun 4, 2021
gregtyler added a commit that referenced this issue May 17, 2022
Rather than embedding SVGs as background images, use
them inline. This allows them to keep their parents' fill
colour, so they can always adapt to match the text.

This is an accessibility enhancement as it means that
users who use tools like high-contrast mode to force
changes in background and foreground colours will
continue to be able to see iconography. Without it, icons
are invisible if they're the same colour as the forced
background colour.

Fixes #162
gregtyler added a commit to gregtyler/moj-frontend that referenced this issue May 17, 2022
Rather than embedding SVGs as background images, use
them inline. This allows them to keep their parents' fill
colour, so they can always adapt to match the text.

When forced color mode is active (e.g. Windows High
Contrast mode), we need to force the fill colour to match
the context (i.e. text or link colour), otherwise it doesn't
pass through properly on Windows.

This is an accessibility enhancement as it means that
users who use tools like high-contrast mode to force
changes in background and foreground colours will
continue to be able to see iconography. Without it, icons
are invisible if they're the same colour as the forced
background colour.

Fixes ministryofjustice#162
gregtyler added a commit that referenced this issue May 18, 2022
Rather than embedding SVGs as background images, use
them inline. This allows them to keep their parents' fill
colour, so they can always adapt to match the text.

When forced color mode is active (e.g. Windows High
Contrast mode), we need to force the fill colour to match
the context (i.e. text or link colour), otherwise it doesn't
pass through properly on Windows.

This is an accessibility enhancement as it means that
users who use tools like high-contrast mode to force
changes in background and foreground colours will
continue to be able to see iconography. Without it, icons
are invisible if they're the same colour as the forced
background colour.

Fixes #162
gregtyler pushed a commit that referenced this issue May 18, 2022
## [1.4.2](v1.4.1...v1.4.2) (2022-05-18)

### Bug Fixes

* markup Banner components as regions ([#359](#359)) ([d38fa96](d38fa96))
* use inline SVGs ([#360](#360)) ([1f89878](1f89878)), closes [#162](#162)
@gregtyler
Copy link
Contributor Author

🎉 This issue has been resolved in version 1.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accessibility bug A task that fixes something that isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant