Skip to content

Commit

Permalink
Add new focus style to buttons
Browse files Browse the repository at this point in the history
Updates based on the changes in:

alphagov/govuk-frontend#1315
  • Loading branch information
tombye committed Sep 11, 2020
1 parent ffe2ea0 commit cc6a7db
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions app/assets/stylesheets/govuk-frontend/focus/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,31 @@
.govuk-details__summary:before {
top: 0;
}

// Updates to buttons
.govuk-button {
&:focus {
border-color: $govuk-focus-colour;
// When colours are overridden, for example when users have a dark mode,
// backgrounds and box-shadows disappear, so we need to ensure there's a
// transparent outline which will be set to a visible colour.
// Since Internet Explorer 8 does not support box-shadow, we want to force the user-agent outlines
@include govuk-not-ie8 {
outline: $govuk-focus-width solid transparent;
outline-offset: 0;
}
// Since Internet Explorer does not support `:not()` we set a clearer focus style to match user-agent outlines.
@include govuk-if-ie8 {
color: $govuk-text-colour;
background-color: $govuk-focus-colour;
}
box-shadow: inset 0 0 0 1px $govuk-focus-colour;
}

&:focus:not(:active):not(:hover) {
border-color: $govuk-focus-colour;
color: $govuk-text-colour;
background-color: $govuk-focus-colour;
box-shadow: 0 2px 0 $govuk-focus-text-colour;
}
}

0 comments on commit cc6a7db

Please sign in to comment.