-
Notifications
You must be signed in to change notification settings - Fork 332
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
Show focus outlines when customising colours settings on Radios and Checkboxes #854
Conversation
src/components/radios/_radios.scss
Outdated
@@ -10,6 +10,7 @@ | |||
@include govuk-exports("govuk/component/radios") { | |||
$govuk-radios-size: govuk-spacing(7); | |||
$govuk-radios-label-padding-left-right: govuk-spacing(3); | |||
$govuk-radios-focus-width: 4px; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming we need to add 1 pixel can this be $govuk-focus-width + 1
so that we understand where this value came from?
src/components/radios/_radios.scss
Outdated
@@ -99,7 +100,12 @@ | |||
|
|||
// Focused state | |||
.govuk-radios__input:focus + .govuk-radios__label::before { | |||
box-shadow: 0 0 0 4px $govuk-focus-colour; | |||
top: -($govuk-radios-focus-width); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense, but could definitely do with a comment to explain what's going on here.
5d87149
to
a93e93e
Compare
a93e93e
to
cea238c
Compare
cea238c
to
bb05940
Compare
This is ace 👏 – @dashouse are you happy with the focus behaviour from a design perspective? |
nice! |
bb05940
to
1160ccb
Compare
1160ccb
to
d551da0
Compare
4456f51
to
3e0d43c
Compare
// We set a transparent outline that is shown instead. | ||
// https://accessibility.blog.gov.uk/2017/03/27/how-users-change-colours-on-websites/ | ||
outline: $govuk-focus-width solid transparent; | ||
outline-offset: $govuk-focus-width; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume you're aware but outline-offset doesn't exist in IE (just came across that recently)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the offset is for mainly aesthetic reasons as this approach does not rely on the gap between the focus and control, having the offset just makes it a bit more clearer that this is a focus and not a thicker border.
Adds invisible outlines that will be shown when colours are overridden.
Checkboxes
Before overriden colours
After overridden colours
Radios
Before overridden colours
After overridden colours
Cross browser testing
Internet Explorer 11
Internet Explorer 10
Internet Explorer 9
Internet Explorer 8
Firefox latest, Chrome latest, Chrome Android latest, Safari latest, Safari iOS latest
No change