From cbb6864a4bec1abdad55d1e63a33e352e9ad02fc Mon Sep 17 00:00:00 2001 From: Massi-X Date: Mon, 9 Dec 2024 20:42:06 +0100 Subject: [PATCH] Fix Tab key after click Tab key didn't work after you select a suggestion with mouse because the input lose focus --- src/parts/events.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/parts/events.js b/src/parts/events.js index 5aac0477..921c8e7c 100644 --- a/src/parts/events.js +++ b/src/parts/events.js @@ -279,9 +279,10 @@ export default { isBelong = withinTag && this.DOM.scope.contains(focusedElm), isInputNode = focusedElm === this.DOM.input, isReadyOnlyTag = isBelong && focusedElm.hasAttribute('readonly'), + tagText = this.DOM.scope.querySelector('.' + this.settings.classNames.tagText), nextTag; - if( !this.state.hasFocus && (!isBelong || isReadyOnlyTag) || isInputNode ) return; + if( !(e.key === 'Tab' && this.state.dropdown.visible) && !this.state.hasFocus && (!isBelong || isReadyOnlyTag) || isInputNode ) return; nextTag = focusedElm.nextElementSibling; @@ -316,6 +317,11 @@ export default { this.dropdown.show() break; } + + case 'Tab': { + tagText?.focus(); + break; + } } },