-
Notifications
You must be signed in to change notification settings - Fork 333
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
Why do checkboxes and radios have transparent backgrounds? #1625
Comments
For some more context this decision was made in the legacy GOV.UK Elements project: alphagov/govuk_elements#296 I've added |
We want to do an investigation into how this would impact users who change their colours, so we're going to put aside an hour to look into this, thanks for raising @davehaigh :) |
Hello @NickColley. I wonder if there is any further development on this topic. I find it strange that most form controls (text input, select and text area) have a defined white background, but checkboxes and radios don't. I gather there must be reasons why radios and checkboxes haven't been given the same background colour to provide consistency in the UI. It would be great to better understand what the reasons are, and if this is something that is supported by user research or other practical reasons. Any insight would be greatly appreciated. |
@robpataki Hi Rob, A quick correction: We don't actually define the white background on text inputs or textareas; these are the user agent styles supplied by the browser. We originally did this because explicitly defining colours (even to make them transparent) used to trigger an accessibility issue in Firefox when using forced colour modes, although this seems to have been fixed since. Conversely, we explicitly define black text and a white background on Unfortunately when it comes to radios and checkboxes, my guess is as good as the commit message in the original post: it's so users who customise their text and background colours get matching styles. |
GOV.UK Frontend radio and checkboxes are rendered with a transparent background, which makes them look wrong on this component's grey background. This is intentional in GOV.UK Frontend and unlikely to change (see alphagov/govuk-frontend#1625).
GOV.UK Frontend radio and checkboxes are rendered with a transparent background, which makes them look wrong on this component's grey background. This is intentional in GOV.UK Frontend and unlikely to change (see alphagov/govuk-frontend#1625).
The following came from a question I asked on the design system slack channel.
https://ukgovernmentdigital.slack.com/archives/C6DMEH5R6/p1572279335253200
TLDR: checkboxes and radios have transparent backgrounds. This means they don't stand out visually against non white panels as text input elements do.
From thread:
does anyone know why the checkboxes (and I assume radio buttons) have transparent backgrounds? Rather than a white background (which would probably be the default browser rendering of a standard checkbox).
GOV checkbox (with transparent background):
Default checkbox (without GOV styling):
Anon 1:
I suspect that’s because they’re custom rendered rather than native checkboxes, and we want to support users who change their text and background colours.
11 replies
Anon 2:
Hi Dave,
This decision pre-dates the design system so I'll need to do a bit of digging to see if we can find out why - but my guess is something along the lines of what Anon 1 said. Will come back to you.
Have you seen any problems around this, or are you just wondering?
After some investigation - it appears that his is the pertinent commit: alphagov/govuk_elements@4972b81
Dave Haigh
I am looking at using small checkboxes as a filter for a list. The filters are located on a light grey panel (similar to the call to action blocks on GOV.UK guidance pages). As you can see in the screenshot the checkbox doesn’t stand out well as the background is transparent.
Im not sure on the answer to this but… should the scenario be:
3.Also, some other elements do not respect user specified background colours such as text inputs (they’re always white). Why are only the checks and radios transparent?
i’ve specified my background colour to be red (in any mode) in this screenshot:
Anon 3
I don’t really have a good answer for you other than that the radios and checkboxes in the Design System are based on those introduced in Elements back in 2016 by people that no longer work here. As Anon 2 said, we don’t have the context of every historical decision. We could definitely look at changing that behaviour, but we’d need to test thoroughly to make sure they still work in all of these sorts of scenarios.
The text was updated successfully, but these errors were encountered: