Skip to content

Commit

Permalink
Redesign focus outline styles
Browse files Browse the repository at this point in the history
  • Loading branch information
tysongach committed May 10, 2017
1 parent 97a2251 commit 2b51aec
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ project adheres to [Semantic Versioning](http://semver.org).
### Added

- Set `margin` to `0` on the `body` element. ([#280])
- Global variables for the styling of focus outlines. ([#284])

### Changed

Expand All @@ -19,6 +20,9 @@ project adheres to [Semantic Versioning](http://semver.org).
element. ([#279])
- `a` elements no longer have `text-decoration` set to `none`. They also now
have `text-decoration-skip` set to `ink`. ([#283])
- The visual style of outlines on focused elements (`a`, `$all-buttons`,
`[type="checkbox"]`, `[type="radio"]`, `[type="file"]`, `select`) is now solid
and offset from the element. ([#284])

### Removed

Expand All @@ -31,6 +35,7 @@ project adheres to [Semantic Versioning](http://semver.org).
[#279]: https://github.com/thoughtbot/bitters/pull/279
[#280]: https://github.com/thoughtbot/bitters/pull/280
[#283]: https://github.com/thoughtbot/bitters/pull/283
[#284]: https://github.com/thoughtbot/bitters/pull/284

## [1.5.0] - 2016-11-08

Expand Down
8 changes: 6 additions & 2 deletions core/_buttons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@
vertical-align: middle;
white-space: nowrap;

&:hover,
&:focus {
&:hover {
background-color: shade($action-color, 20%);
color: #fff;
}

&:focus {
outline: $focus-outline;
outline-offset: $focus-outline-offset;
}

&:disabled {
cursor: not-allowed;
opacity: 0.5;
Expand Down
10 changes: 10 additions & 0 deletions core/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,13 @@ select {
margin-bottom: $small-spacing;
width: 100%;
}

[type="checkbox"],
[type="radio"],
[type="file"],
select {
&:focus {
outline: $focus-outline;
outline-offset: $focus-outline-offset;
}
}
7 changes: 5 additions & 2 deletions core/_typography.scss
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@ a {
text-decoration-skip: ink;
transition: color $base-duration $base-timing;

&:active,
&:focus,
&:hover {
color: shade($action-color, 25%);
}

&:focus {
outline: $focus-outline;
outline-offset: $focus-outline-offset;
}
}

hr {
Expand Down
6 changes: 6 additions & 0 deletions core/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ $base-border: 1px solid $base-border-color;
$base-background-color: #fff;
$secondary-background-color: tint($base-border-color, 75%);

// Focus
$focus-outline-color: transparentize($action-color, 0.4);
$focus-outline-width: 3px;
$focus-outline: $focus-outline-width solid $focus-outline-color;
$focus-outline-offset: 2px;

// Animations
$base-duration: 150ms;
$base-timing: ease;

0 comments on commit 2b51aec

Please sign in to comment.