From b9e02059b27758e80387683f4c103f96a0ffc5cb Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Tue, 12 Sep 2023 16:21:42 +0300 Subject: [PATCH] Attempt to improve combobox in modal keyboard behaviour --- assets/js/liveview/suggestions_dropdown.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/assets/js/liveview/suggestions_dropdown.js b/assets/js/liveview/suggestions_dropdown.js index f89cf7b8d..761c0a4be 100644 --- a/assets/js/liveview/suggestions_dropdown.js +++ b/assets/js/liveview/suggestions_dropdown.js @@ -40,7 +40,12 @@ let suggestionsDropdown = function(id) { const currentFocus = this.focus return currentFocus - 1 >= this.leastFocusableIndex() ? currentFocus - 1 : this.maxFocusableIndex() }, - close() { this.isOpen = false }, + close(e) { + if (this.isOpen) { + e.stopPropagation() + } + this.isOpen = false + }, select() { this.$refs[`dropdown-${this.id}-option-${this.focus}`]?.click() this.close()