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

Fix select component renders with grey background in Firefox and Safari #2524

Merged
merged 2 commits into from
Feb 1, 2022

Conversation

vanitabarrett
Copy link
Contributor

@vanitabarrett vanitabarrett commented Jan 31, 2022

Fixes #2435

What

Sets background colour and text colour on the select component so that we have more control over the background and foreground colour and don't get influenced by browser defaults which sometimes default to a grey background.

Why

We have had two separate reports from users of the select component appearing with a grey background in Firefox and iOS Safari. In iOS Safari, the text within the select also appears as blue - the blue text on grey background does not meet colour contrast (ratio 2.19:1). We should probably raise a WebKit bug for this too, but alongside the issue in Firefox it probably also makes sense for us to look at getting more control over our component styling too.

Screenshots (default component)

Chrome:
Screenshot 2022-01-31 at 15 25 18
Screenshot 2022-01-31 at 15 25 25

iOS:
Screenshot 2022-01-31 at 15 33 37

Firefox:
Screenshot 2022-01-31 at 15 45 55
Screenshot 2022-01-31 at 15 45 52

IE11:
Screenshot 2022-01-31 at 15 49 24
Screenshot 2022-01-31 at 15 49 28

Screenshots (colours changed)

Windows High Contrast, Edge:
Screenshot 2022-01-31 at 15 17 29

Windows High Contrast, Chrome:
Screenshot 2022-01-31 at 15 18 55

Windows High Contrast, Firefox:
Screenshot 2022-01-31 at 15 19 42

Windows High Contrast, IE11:
Screenshot 2022-01-31 at 15 20 47
Screenshot 2022-01-31 at 15 20 31

Firefox (changed colours):
Screenshot 2022-01-31 at 15 46 22
Screenshot 2022-01-31 at 15 46 25

@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2524 January 31, 2022 15:14 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2524 January 31, 2022 16:05 Inactive
@vanitabarrett vanitabarrett changed the title WIP select background fix Fix select component renders with grey background in Firefox and Safari Jan 31, 2022
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2524 January 31, 2022 17:03 Inactive
@vanitabarrett vanitabarrett marked this pull request as ready for review February 1, 2022 09:32
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2524 February 1, 2022 09:34 Inactive
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-pr-2524 February 1, 2022 09:36 Inactive
Copy link
Contributor

@36degrees 36degrees left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me, and a big improvement in Firefox and iOS – although I haven't tested in any other browsers.

My only comment is a minor one, about the comment!

src/govuk/components/select/_index.scss Outdated Show resolved Hide resolved
Vanita Barrett added 2 commits February 1, 2022 13:59
Sets the background and foreground colours (`background-color` and `color`)
on the select component to fix #2435

We're setting both the background and foreground so we don't fail WCAG by specifying
background colours without foreground colour (https://www.w3.org/TR/WCAG20-TECHS/F24.html):
Unless an author specifies both foreground and background colors, then they (the author)
can no longer guarantee that the user will get a contrast that meets the contrast requirements.
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

Successfully merging this pull request may close these issues.

Select elements have grey background in Firefox
3 participants