Skip to content

Commit

Permalink
fix(cdk/overlay): not setting correct opacity in high contrast mode o…
Browse files Browse the repository at this point in the history
…n Firefox (#21896)

The backdrop styles were never switches to the `cdk-high-contrast` mixin which means that
they won't work on Firefox. These changes switch to using the mixin and update the docs.

Fixes #21890.
  • Loading branch information
crisbeto authored Feb 18, 2021
1 parent ca37709 commit 4b8427e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CODING_STANDARDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ specific error being caught and why it cannot be prevented.
* Except for `@Input` properties, use `is` and `has` prefixes for boolean properties / methods.
##### Observables
* Don't suffix observables with `$`.
* Don't suffix observables with `$`.
##### Classes
Classes should be named based on what they're responsible for. Names should capture what the code
Expand Down Expand Up @@ -333,7 +333,7 @@ The latter is equivalent for the component, but makes it easier override when ne
#### Support styles for Windows high-contrast mode
This is a low-effort task that makes a big difference for low-vision users. Example:
```css
@media screen and (-ms-high-contrast: active) {
@include cdk-high-contrast(active, off) {
.unicorn-motocycle {
border: 1px solid #fff !important;
}
Expand Down
5 changes: 4 additions & 1 deletion src/cdk/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ sass_library(
sass_binary(
name = "overlay_prebuilt_scss",
src = "overlay-prebuilt.scss",
deps = [":overlay_scss_lib"],
deps = [
":overlay_scss_lib",
"//src/cdk/a11y:a11y_scss_lib",
],
)

ng_test_library(
Expand Down
4 changes: 3 additions & 1 deletion src/cdk/overlay/_overlay.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../a11y/a11y';

// We want overlays to always appear over user content, so set a baseline
// very high z-index for the overlay container, which is where we create the new
// stacking context for all overlays.
Expand Down Expand Up @@ -84,7 +86,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
// to making it opaque using `opacity`. Note that we can't use the `cdk-high-contrast`
// mixin, because we can't normalize the import path to the _a11y.scss both for the
// source and when this file is distributed. See #10908.
@media screen and (-ms-high-contrast: active) {
@include cdk-high-contrast(active, off) {
opacity: 0.6;
}
}
Expand Down

0 comments on commit 4b8427e

Please sign in to comment.