Skip to content

Commit

Permalink
select mode should not auto-complete when pressing the TAB button bec…
Browse files Browse the repository at this point in the history
…ause the `autocomplete` method cannot currently work for select mode since it only works for the input element which is hidden in select mode
  • Loading branch information
yairEO committed Mar 16, 2024
1 parent aca03a0 commit 10078f1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/parts/suggestions.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ export default {
var _s = this.settings,
selectedElm = this.DOM.dropdown.querySelector(_s.classNames.dropdownItemActiveSelector),
selectedElmData = this.dropdown.getSuggestionDataByNode(selectedElm),
isMixMode = _s.mode == 'mix';
isMixMode = _s.mode == 'mix',
isSelectMode = _s.mode == 'select';

_s.hooks.beforeKeyDown(e, {tagify:this})
.then(result => {
Expand Down Expand Up @@ -86,7 +87,7 @@ export default {
let shouldAutocompleteOnKey = !_s.autoComplete.rightKey || !_s.autoComplete.tabKey

// in mix-mode, treat arrowRight like Enter key, so a tag will be created
if( !isMixMode && selectedElm && shouldAutocompleteOnKey && !this.state.editing ){
if( !isMixMode && !isSelectMode && selectedElm && shouldAutocompleteOnKey && !this.state.editing ){
e.preventDefault() // prevents blur so the autocomplete suggestion will not become a tag
var value = this.dropdown.getMappedValue(selectedElmData)

Expand Down

0 comments on commit 10078f1

Please sign in to comment.