Skip to content

Commit

Permalink
fix(button): focus state matches spec
Browse files Browse the repository at this point in the history
  • Loading branch information
jelbourn committed May 19, 2016
1 parent 9e308a6 commit 8eb1eeb
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/components/button/_button-base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,17 @@ $md-mini-fab-padding: 8px !default;
@include md-elevation(8);
}

&.md-button-focus {
background-color: md-color($md-foreground, base, 0.12);
@include md-button-theme('background-color', 600);
&.md-button-focus:after {
// The button spec calls for focus on raised buttons (and FABs) to be indicated with a
// black, 12% opacity shade over the normal color (for both light and dark themes).
// We do this by placing an :after psuedo-element with the appropriate shade over the button.
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
content: '';
background-color: rgba(black, 0.12);
}

&[disabled] {
Expand All @@ -111,7 +119,8 @@ $md-mini-fab-padding: 8px !default;
padding: $padding 0;
}

&.md-button-focus {
background-color: md-color($md-accent, 600);
// The focus shading for FABs needs to match the FAB's circular shape.
&.md-button-focus:after {
border-radius: 50%;
}
}

0 comments on commit 8eb1eeb

Please sign in to comment.