Skip to content

Commit 2894a71

Browse files
crisbetojelbourn
authored andcommitted
fix(datepicker): range input separator not hidden in high contrast mode (#19706)
We use `color: transparent` to hide the separator text, but browsers will still show it in high contrast mode. These changes use `opacity` instead.
1 parent 92bc813 commit 2894a71

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/material/datepicker/date-range-input.scss

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,11 @@
33

44
$mat-date-range-input-separator-spacing: 4px;
55
$mat-date-range-input-part-max-width: calc(50% - #{$mat-date-range-input-separator-spacing});
6-
$mat-date-range-input-placeholder-transition:
7-
color $swift-ease-out-duration $swift-ease-out-duration / 3 $swift-ease-out-timing-function;
6+
7+
@mixin _mat-date-range-input-placeholder-transition($property) {
8+
transition: #{$property} $swift-ease-out-duration $swift-ease-out-duration / 3
9+
$swift-ease-out-timing-function;
10+
}
811

912
// Host of the date range input.
1013
.mat-date-range-input {
@@ -20,15 +23,17 @@ $mat-date-range-input-placeholder-transition:
2023

2124
// Text shown between the two inputs.
2225
.mat-date-range-input-separator {
26+
@include _mat-date-range-input-placeholder-transition(opacity);
2327
margin: 0 $mat-date-range-input-separator-spacing;
24-
transition: $mat-date-range-input-placeholder-transition;
2528
}
2629

2730
.mat-date-range-input-separator-hidden {
2831
// Disable text selection, because the user can click
2932
// through the main label when the input is disabled.
3033
@include user-select(none);
31-
color: transparent;
34+
35+
// Use opacity to hide the text, because `color: transparent` will be shown in high contrast mode.
36+
opacity: 0;
3237
transition: none;
3338
}
3439

@@ -54,7 +59,7 @@ $mat-date-range-input-placeholder-transition:
5459
}
5560

5661
@include input-placeholder {
57-
transition: $mat-date-range-input-placeholder-transition;
62+
@include _mat-date-range-input-placeholder-transition(color);
5863
}
5964

6065
.mat-form-field-hide-placeholder &,

0 commit comments

Comments
 (0)