Skip to content

Commit 5e15dc2

Browse files
committed
VIP - Stop search input change event propagation in combobox
Add a bound `change` event handler for the combobox search input that calls `stopPropagation()` to prevent parent handlers from receiving the change event. The handler is attached on connect and removed on disconnect to ensure proper cleanup and avoid leaks.
1 parent e85e536 commit 5e15dc2

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

priv/assets/js/combobox.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@ let Combobox = {
3131

3232
if (this.searchInput) {
3333
this.boundSearchInputHandler = this.handleSearch.bind(this);
34+
this.boundSearchChangeHandler = (e) => e.stopPropagation();
3435
this.searchInput.addEventListener("input", this.boundSearchInputHandler);
36+
this.searchInput.addEventListener(
37+
"change",
38+
this.boundSearchChangeHandler,
39+
);
3540
this.searchInput.addEventListener("keydown", this.boundHandleKeyDown);
3641
}
3742

@@ -953,6 +958,10 @@ let Combobox = {
953958
"input",
954959
this.boundSearchInputHandler,
955960
);
961+
this.searchInput.removeEventListener(
962+
"change",
963+
this.boundSearchChangeHandler,
964+
);
956965
this.searchInput.removeEventListener("keydown", this.boundHandleKeyDown);
957966
}
958967

0 commit comments

Comments
 (0)