From 5862c7ea91208cb8845a3a0226710b2042e24020 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Sun, 23 Jun 2024 12:07:24 -0400 Subject: [PATCH] don't block enter/tab for items with valueProvider --- public/scripts/autocomplete/AutoComplete.js | 2 ++ public/scripts/autocomplete/AutoCompleteOption.js | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/public/scripts/autocomplete/AutoComplete.js b/public/scripts/autocomplete/AutoComplete.js index bd5ae9da9..521a8c7e1 100644 --- a/public/scripts/autocomplete/AutoComplete.js +++ b/public/scripts/autocomplete/AutoComplete.js @@ -721,6 +721,7 @@ export class AutoComplete { // pick the selected item to autocomplete if (evt.ctrlKey || evt.altKey || evt.shiftKey || this.selectedItem.value == '') break; if (this.selectedItem.name == this.name) break; + if (!this.selectedItem.isSelectable) break; evt.preventDefault(); evt.stopImmediatePropagation(); this.select(); @@ -729,6 +730,7 @@ export class AutoComplete { case 'Tab': { // pick the selected item to autocomplete if (evt.ctrlKey || evt.altKey || evt.shiftKey || this.selectedItem.value == '') break; + if (!this.selectedItem.isSelectable) break; evt.preventDefault(); evt.stopImmediatePropagation(); this.select(); diff --git a/public/scripts/autocomplete/AutoCompleteOption.js b/public/scripts/autocomplete/AutoCompleteOption.js index 621fe368a..a946a462f 100644 --- a/public/scripts/autocomplete/AutoCompleteOption.js +++ b/public/scripts/autocomplete/AutoCompleteOption.js @@ -23,6 +23,10 @@ export class AutoCompleteOption { return this.name; } + get isSelectable() { + return !this.valueProvider; + } + /** * @param {string} name