Skip to content

Commit

Permalink
fix: Calendar selection is applied when the component is readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
rkaraivanov committed Apr 29, 2024
1 parent 6cec176 commit 059be15
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/date-picker/date-picker.ts
Expand Up @@ -524,12 +524,13 @@ export default class IgcDatepickerComponent extends FormAssociatedRequiredMixin(
this.emitEvent('igcChange', { detail: this.value });
}

protected handleCalendarChangeEvent(event: CustomEvent<Date>) {
protected async handleCalendarChangeEvent(event: CustomEvent<Date>) {
event.stopPropagation();

if (this.readOnly) {
event.preventDefault();
this._calendar.value = this.value ?? undefined;
// Wait till the calendar finishes updating and then restore the current value from the date-picker.
await this._calendar.updateComplete;
this._calendar.value = this._value ?? undefined;
return;
}

Expand Down

0 comments on commit 059be15

Please sign in to comment.