From 507ece878b3a2f46f6ec13cc88f4870aff8f9957 Mon Sep 17 00:00:00 2001 From: Geert Selderslaghs Date: Sat, 4 Jan 2025 18:32:52 +0100 Subject: [PATCH] fix(Autocomplete) remove conditional check on html and static handling of toggling checkbox since list is empty if minLength option is greater then 0 #479 --- src/autocomplete.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/autocomplete.ts b/src/autocomplete.ts index f724b1ed32..ea9785564c 100644 --- a/src/autocomplete.ts +++ b/src/autocomplete.ts @@ -552,16 +552,18 @@ export class Autocomplete extends Component { const entry = this.menuItems.find((item) => item.id == id); if (!entry) return; // Toggle Checkbox - const li = this.container.querySelector('li[data-id="' + id + '"]'); - if (!li) return; + /* const li = this.container.querySelector('li[data-id="' + id + '"]'); + if (!li) return;*/ if (this.options.isMultiSelect) { - const checkbox = li.querySelector('input[type="checkbox"]'); + /* const checkbox = li.querySelector('input[type="checkbox"]'); checkbox.checked = !checkbox.checked; if (checkbox.checked) this.selectedValues.push(entry); else this.selectedValues = this.selectedValues.filter( (selectedEntry) => selectedEntry.id !== entry.id - ); + );*/ + this.selectedValues.push(entry); + this._renderDropdown(); this.el.focus(); } else { // Single-Select