Skip to content

Commit 14ed37a

Browse files
eriklharperbenelan
authored andcommitted
fix(input-time-picker): isolate calciteTimeChange event listener to just the component instance it was fired from (#12109)
**Related Issue:** #11712 ## Summary This PR fixes a critical issue caused by changes added in #11712 that caused multiple instances of `calcite-input-time-picker` on a single page to get updated when only 1 instance's value changed.
1 parent 4e19d9a commit 14ed37a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/calcite-components/src/components/input-time-picker/input-time-picker.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ export class InputTimePicker
266266
super();
267267
this.listen("blur", this.blurHandler);
268268
this.listen("keydown", this.keyDownHandler);
269-
this.listenOn(window, "calciteTimeChange", this.timeChangeHandler);
269+
this.listen("calciteTimeChange", this.timeChangeHandler);
270270
}
271271

272272
override connectedCallback(): void {
@@ -496,7 +496,12 @@ export class InputTimePicker
496496
syncHiddenFormInput("time", this, input);
497497
}
498498

499-
private timeChangeHandler({ detail: newValue }): void {
499+
private timeChangeHandler(event): void {
500+
if (this.disabled) {
501+
return;
502+
}
503+
504+
const newValue = event.detail;
500505
if (newValue !== this.value) {
501506
this.value = newValue;
502507
}

0 commit comments

Comments
 (0)