From a15ec0006eba20081ba29836bf8211d5363236aa Mon Sep 17 00:00:00 2001 From: Christian Bastian <80225746+cdb-boop@users.noreply.github.com> Date: Sun, 31 Mar 2024 05:00:49 -0400 Subject: [PATCH] Fixed bug where Enter read from hidden dropdown. --- web/model-manager.js | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/web/model-manager.js b/web/model-manager.js index ee2f02c..138cd8f 100644 --- a/web/model-manager.js +++ b/web/model-manager.js @@ -990,20 +990,22 @@ class DirectoryDropdown { } else if (e.key === "Enter") { e.stopPropagation(); - const input = e.target - const selection = options[iSelection]; - if (selection !== undefined && selection !== null) { - DirectoryDropdown.selectionToInput( - input, - selection, - modelData.searchSeparator, - DROPDOWN_DIRECTORY_SELECTION_KEY_CLASS - ); - const path = this.#updateOptions(); - if (path !== undefined) { - this.#updateDeepestPath(path); + const input = e.target; + if (dropdown.style.display !== "none") { + const selection = options[iSelection]; + if (selection !== undefined && selection !== null) { + DirectoryDropdown.selectionToInput( + input, + selection, + modelData.searchSeparator, + DROPDOWN_DIRECTORY_SELECTION_KEY_CLASS + ); + const path = this.#updateOptions(); + if (path !== undefined) { + this.#updateDeepestPath(path); + } + updateCallback(); } - updateCallback(); } await submitCallback(); input.blur();