Skip to content

Commit 98bc6f4

Browse files
authored
fix(material/datepicker): date ranges not visible in high contrast mode (#23038)
Fixes that the date ranges are invisible in high contrast mode. Fixes #23034.
1 parent da91c18 commit 98bc6f4

File tree

1 file changed

+59
-1
lines changed

1 file changed

+59
-1
lines changed

src/material/datepicker/calendar-body.scss

Lines changed: 59 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,11 @@ $calendar-range-end-body-cell-size:
194194
}
195195

196196
@include a11y.high-contrast(active, off) {
197+
$main-range-border: solid 1px;
198+
$comparison-range-border: dashed 1px;
199+
197200
.mat-datepicker-popup:not(:empty),
198-
.mat-calendar-body-selected {
201+
.mat-calendar-body-cell:not(.mat-calendar-body-in-range) .mat-calendar-body-selected {
199202
outline: solid 1px;
200203
}
201204

@@ -209,6 +212,61 @@ $calendar-range-end-body-cell-size:
209212
outline: dotted 2px;
210213
}
211214
}
215+
216+
// These backgrounds need to be removed, because they'll block the date ranges.
217+
.mat-calendar-body-cell::before,
218+
.mat-calendar-body-cell::after,
219+
.mat-calendar-body-selected {
220+
background: none;
221+
}
222+
223+
.mat-calendar-body-in-range::before,
224+
.mat-calendar-body-comparison-bridge-start::before,
225+
.mat-calendar-body-comparison-bridge-end::before {
226+
border-top: $main-range-border;
227+
border-bottom: $main-range-border;
228+
}
229+
230+
.mat-calendar-body-range-start::before {
231+
border-left: $main-range-border;
232+
233+
[dir='rtl'] & {
234+
border-left: 0;
235+
border-right: $main-range-border;
236+
}
237+
}
238+
239+
.mat-calendar-body-range-end::before {
240+
border-right: $main-range-border;
241+
242+
[dir='rtl'] & {
243+
border-right: 0;
244+
border-left: $main-range-border;
245+
}
246+
}
247+
248+
.mat-calendar-body-in-comparison-range::before {
249+
border-top: $comparison-range-border;
250+
border-bottom: $comparison-range-border;
251+
}
252+
253+
.mat-calendar-body-comparison-start::before {
254+
border-left: $comparison-range-border;
255+
256+
[dir='rtl'] & {
257+
border-left: 0;
258+
border-right: $comparison-range-border;
259+
}
260+
}
261+
262+
.mat-calendar-body-comparison-end::before {
263+
border-right: $comparison-range-border;
264+
265+
[dir='rtl'] & {
266+
border-right: 0;
267+
border-left: $comparison-range-border;
268+
}
269+
}
212270
}
213271

214272
[dir='rtl'] {

0 commit comments

Comments
 (0)