Skip to content

Commit fffbcb1

Browse files
crisbetoandrewseguin
authored andcommittedJan 23, 2019
fix(button): focus indication hard to see in high contrast mode (#13259)
* When we switched to the new design, we also switched our approach to how the focus overlay is shown (using `opacity` vs `display`), however we never switched the focus indicator's background to a solid color, which means that it's opacity when displayed is close to zero (0.5 * 0.012 = 0.006). These changes switch it to a solid color. * Fixes the focus indicator being white on a white background, when the user has high contrast set to black-on-white.
1 parent cbdddf4 commit fffbcb1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed
 

‎src/lib/button/button.scss

+8-2
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@
109109
// Element that overlays the button to show focus and hover effects.
110110
.mat-button-focus-overlay {
111111
opacity: 0;
112-
113112
transition: $mat-button-focus-transition;
114113

115114
._mat-animation-noopable & {
@@ -120,7 +119,14 @@
120119
// Note that IE will render this in the same way, no
121120
// matter whether the theme is light or dark. This helps
122121
// with the readability of focused buttons.
123-
background-color: rgba(white, 0.5);
122+
background-color: #fff;
123+
}
124+
125+
@include cdk-high-contrast(black-on-white) {
126+
// For the black-on-white high contrast mode, the browser will set this element
127+
// to white, making it blend in with the background, hence why we need to set
128+
// it explicitly to black.
129+
background-color: #000;
124130
}
125131
}
126132

0 commit comments

Comments
 (0)
Please sign in to comment.