Skip to content

Commit b0cf785

Browse files
committed
style(datepicker): change box shadow to outline as disabled td interferes with box shadow appearance
1 parent a17d33e commit b0cf785

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

src/components/Datepicker/datepicker-calendar.css

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ button.year.active:not(.selected-ends)
2828
background-color: var(--sgds-form-primary-bg-translucent);
2929
border-radius: 0;
3030
}
31+
3132
td[data-day]:hover:not(.disabled):not(.selected-ends):not(.active),
3233
button.month:hover:not(.active),
3334
button.year:hover:not(.active) {
@@ -37,8 +38,12 @@ button.year:hover:not(.active) {
3738
td[data-day]:focus,
3839
button.month:focus,
3940
button.year:focus {
40-
box-shadow: var(--sgds-box-shadow-focus);
41-
outline: unset;
41+
outline: var(--sgds-form-border-radius-sm) solid var(--sgds-blue-400);
42+
}
43+
td[data-day].active:not(.selected-ends):focus,
44+
button.month.active:not(.selected-ends):focus,
45+
button.year.active:not(.selected-ends):focus {
46+
border-radius: var(--sgds-form-border-radius-sm);
4247
}
4348
button.year.active {
4449
cursor: pointer;
@@ -61,6 +66,7 @@ button.year.active.selected-ends {
6166
background-color: var(--sgds-form-primary-bg);
6267
color: var(--sgds-form-color-on-dark);
6368
}
69+
6470
td[data-day].disabled {
6571
opacity: var(--sgds-opacity-50);
6672
cursor: not-allowed;

src/components/Datepicker/datepicker-calendar.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ export class DatepickerCalendar extends SgdsElement {
9393
connectedCallback(): void {
9494
super.connectedCallback();
9595
this.addEventListener("keydown", this._handleKeyPress);
96+
/** Prevent validation from happening when navigating the calendar */
97+
this.addEventListener("blur", e => e.stopPropagation());
9698
}
9799

98100
updated() {

src/components/Datepicker/sgds-datepicker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ export class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) impl
320320
private async _handleInvalidInput() {
321321
this.selectedDateRange = [];
322322
this.displayDate = this.initialDisplayDate;
323-
this.invalid = true
323+
this.invalid = true;
324324
this._manageInternalsBadInput();
325325
}
326326
private async _handleEmptyInput() {

0 commit comments

Comments
 (0)