Skip to content

Commit 745ba15

Browse files
committed
fix(button): focus state matches spec
1 parent 55cc197 commit 745ba15

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/components/button/_button-base.scss

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,19 @@ $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+
border-radius: inherit;
100+
pointer-events: none;
91101
}
92102

93103
&[disabled] {
@@ -110,8 +120,4 @@ $md-mini-fab-padding: 8px !default;
110120
i, md-icon {
111121
padding: $padding 0;
112122
}
113-
114-
&.md-button-focus {
115-
background-color: md-color($md-accent, 600);
116-
}
117123
}

0 commit comments

Comments
 (0)