From dc8809ef87ec3556aebaf8cf715927f6a23e4810 Mon Sep 17 00:00:00 2001 From: nathan Date: Thu, 7 Jul 2022 10:47:14 -0600 Subject: [PATCH] Et2Select + Search: Always need to bind our own change handler to catch & cancel search textbox changes or they bubble --- api/js/etemplate/Et2Select/SearchMixin.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/Et2Select/SearchMixin.ts b/api/js/etemplate/Et2Select/SearchMixin.ts index 558f56c25a..7a7e1ea95b 100644 --- a/api/js/etemplate/Et2Select/SearchMixin.ts +++ b/api/js/etemplate/Et2Select/SearchMixin.ts @@ -448,16 +448,18 @@ export const Et2WithSearchMixin = >(superclass this.addEventListener("sl-blur", this._handleSearchAbort); this.addEventListener("sl-select", this._handleSelect); this.addEventListener("sl-clear", this._handleClear) + + // Need our own change to catch the change event from search input + this.addEventListener("change", this._handleChange); + this.updateComplete.then(() => { // Search messes up event order. Since it throws its own bubbling change event, // selecting an option fires 2 change events - 1 before the widget is finished adjusting, losing the value // We catch all change events, then call this._oldChange only when value changes this.removeEventListener("change", this._oldChange); - // Need our own change to catch the change event from search input - this.addEventListener("change", this._handleChange); }); - + this._searchButtonNode.addEventListener("click", this._handleSearchButtonClick); }