Skip to content

Commit

Permalink
Merge pull request #163 from amaury-hanser/a11y/btn-focus
Browse files Browse the repository at this point in the history
Improvement: Updates focus state for buttons
  • Loading branch information
Progi1984 authored Sep 21, 2021
2 parents 939125d + 4a02315 commit 54de322
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/css/bootstrap-prestashop-ui-kit.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-prestashop-ui-kit.css.map

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion scss/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

border-color: $gray-300;

&:hover {
&:hover,
&:focus {
border-color: $gray-300;
}

Expand Down
1 change: 1 addition & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ $warning: $yellow !default;
$danger: $red !default;
$light: $gray-100 !default;
$dark: $gray-800 !default;
$outline-color: #005fcc;

$toast-success: #53d572 !default;
$toast-warning: #fab000 !default;
Expand Down
26 changes: 24 additions & 2 deletions scss/mixins/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,14 @@
&:focus,
&.focus {
color: $white;
background-color: $background;
border-color: $background;
background-color: $hover-background;
border-color: $hover-border;
}

&:focus-visible {
// stylelint-disable-next-line
outline: 2px auto $outline-color !important;
outline-offset: 3px;
box-shadow: none;
}

Expand Down Expand Up @@ -65,6 +71,22 @@

&:focus,
&.focus {
color: $color-hover;
background-color: theme-color-hover($color-name);
border-color: theme-color-hover($color-name);
outline: 2px solid #005fcc;
outline-style: auto;
outline-offset: 3px;

&:not(:focus-visible) {
outline: 0;
}
}

&:focus-visible {
// stylelint-disable-next-line
outline: 2px auto $outline-color !important;
outline-offset: 3px;
box-shadow: none;
}

Expand Down

0 comments on commit 54de322

Please sign in to comment.