Skip to content

Commit 8eb1eeb

Browse files
committed
fix(button): focus state matches spec
1 parent 9e308a6 commit 8eb1eeb

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

src/components/button/_button-base.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,17 @@ $md-mini-fab-padding: 8px !default;
8585
@include md-elevation(8);
8686
}
8787

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

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

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

0 commit comments

Comments
 (0)