Skip to content

Commit c8462f5

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

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/components/button/_button-base.scss

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,18 @@ $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);
99+
pointer-events: none;
91100
}
92101

93102
&[disabled] {
@@ -111,7 +120,8 @@ $md-mini-fab-padding: 8px !default;
111120
padding: $padding 0;
112121
}
113122

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

0 commit comments

Comments
 (0)