fix(ui): block native change events in searchable-select component

Native change events from child inputs were bubbling up and reaching
data-on:change handlers, which expect only the CustomEvent with
evt.detail. Capture and stop native change events so only the
component's own CustomEvent propagates.
This commit is contained in:
Jon Seager 2026-02-07 08:28:22 +00:00
parent 766376be12
commit 28a64a93d1
No known key found for this signature in database

View file

@ -41,6 +41,12 @@ customElements.define("searchable-select", class extends HTMLElement {
selectedWrap.appendChild(display); selectedWrap.appendChild(display);
selectedWrap.appendChild(clear); selectedWrap.appendChild(clear);
// Block native change events from child inputs so only our
// CustomEvent (which carries evt.detail) reaches data-on:change.
this.addEventListener("change", (e) => {
if (!(e instanceof CustomEvent)) e.stopImmediatePropagation();
}, true);
this.textContent = ""; this.textContent = "";
this.style.display = "block"; this.style.display = "block";
this.appendChild(hidden); this.appendChild(hidden);