Skip to content

Commit c6547a6

Browse files
fix(date-picker): prevent value changes when disabled or readonly
Prevent the date picker from responding to focus events or input changes when the component is disabled or readonly. This ensures that disabled date pickers cannot be interacted with via keyboard or mouse. Fixes #3815
1 parent 50cd04b commit c6547a6

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

src/components/date-picker/date-picker.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ export class DatePicker {
279279
}
280280

281281
private showCalendar(event) {
282+
if (this.disabled || this.readonly) {
283+
return;
284+
}
282285
this.showPortal = true;
283286
const inputElement = this.textField.shadowRoot.querySelector('input');
284287
setTimeout(() => {
@@ -369,6 +372,10 @@ export class DatePicker {
369372
}
370373

371374
private handleInputElementChange(event) {
375+
if (this.disabled || this.readonly) {
376+
event.stopPropagation();
377+
return;
378+
}
372379
if (event.detail === '') {
373380
this.clearValue();
374381
}

0 commit comments

Comments
 (0)