Fix text contrast of disabled
checkboxes
#5155
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We have noticed that when checkboxes have the
disabled
attribute set1, the text does not meet WCAG standards2 for colour contrast. This is true for the label3, and worse for the hint text4.This is caused by some CSS in GOV.UK Frontend5.
I propose:
currentColor
)This is the same thing we did for radio buttons in #4744
Before
After
disabled
is not often the best way to do things (and is not documented in the Design System) but sometimes it’s appropriate$govuk-text-colour
withopacity: .5
applied computes to a value of#858585
, which gives a contrast ratio of 3.69:1 against a white background$govuk-secondary-text-colour
withopacity: .5
applied computes to a value of#a8acae
, which gives a contrast ratio of 2.28:1 against a white backgrounddisabled
attribute itself, the different cursor behaviour, and the content of the hint text