Skip to content

Commit 1d878f1

Browse files
committed
refactor(Calendar): improve focus style
1 parent 12a145f commit 1d878f1

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

scss/_calendar.scss

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
--#{$prefix}calendar-cell-week-number-color: #{$calendar-cell-week-number-color};
2222
--#{$prefix}calendar-cell-hover-color: #{$calendar-cell-hover-color};
2323
--#{$prefix}calendar-cell-hover-bg: #{$calendar-cell-hover-bg};
24+
--#{$prefix}calendar-cell-focus-box-shadow: #{$calendar-cell-focus-box-shadow};
2425
--#{$prefix}calendar-cell-disabled-color: #{$calendar-cell-disabled-color};
2526
--#{$prefix}calendar-cell-selected-color: #{$calendar-cell-selected-color};
2627
--#{$prefix}calendar-cell-selected-bg: #{$calendar-cell-selected-bg};
@@ -231,6 +232,14 @@
231232
@include border-radius($border-radius);
232233
}
233234

235+
.calendars:not(.select-week) &:focus-visible {
236+
outline: 0;
237+
238+
.calendar-cell-inner {
239+
box-shadow: var(--#{$prefix}calendar-cell-focus-box-shadow);
240+
@include border-radius($border-radius);
241+
}
242+
}
234243
}
235244

236245
.calendar-row {
@@ -259,6 +268,12 @@
259268
@include border-end-radius($border-radius);
260269
}
261270
}
271+
272+
&:focus-visible {
273+
outline: 0;
274+
box-shadow: var(--#{$prefix}calendar-cell-focus-box-shadow);
275+
@include border-radius($border-radius);
276+
}
262277
}
263278

264279
@if $enable-dark-mode {

scss/_variables.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2323,6 +2323,8 @@ $calendar-cell-hover-color: var(--#{$prefix}body-color) !defaul
23232323
$calendar-cell-hover-bg: var(--#{$prefix}tertiary-bg) !default;
23242324
$calendar-cell-disabled-color: var(--#{$prefix}tertiary-color) !default;
23252325

2326+
$calendar-cell-focus-box-shadow: $focus-ring-box-shadow !default;
2327+
23262328
$calendar-cell-selected-color: $white !default;
23272329
$calendar-cell-selected-bg: var(--#{$prefix}primary) !default;
23282330

0 commit comments

Comments
 (0)