Skip to content

Commit

Permalink
Fix Tab key after click
Browse files Browse the repository at this point in the history
Tab key didn't work after you select a suggestion with mouse because the input lose focus
  • Loading branch information
Massi-X authored and yairEO committed Dec 21, 2024
1 parent bc105a5 commit cbb6864
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/parts/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -316,6 +317,11 @@ export default {
this.dropdown.show()
break;
}

case 'Tab': {
tagText?.focus();
break;
}
}
},

Expand Down

0 comments on commit cbb6864

Please sign in to comment.