Skip to content

Commit

Permalink
selectOption dropdown method should not return on mix-mode when `…
Browse files Browse the repository at this point in the history
…this.DOM.input.parentNode` does not exists
  • Loading branch information
yairEO committed Feb 12, 2024
1 parent ef50d7e commit 57cb194
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/parts/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ export default {
if( !isMixMode )
this.addTags(this.state.inputText.trim(), true)
})
.catch(err => err)
.catch(err => console.warn(err))

break;
}
Expand Down Expand Up @@ -614,6 +614,7 @@ export default {

var value = elm.getAttribute('value'),
isNoMatch = value == 'noMatch',
isMixMode = _s.mode == 'mix',
tagData = this.suggestedListItems.find(item => (item.value ?? item) == value)

// The below event must be triggered, regardless of anything else which might go wrong
Expand All @@ -633,11 +634,10 @@ export default {
}
// Tagify instances should re-focus to the input element once an option was selected, to allow continuous typing
else {
this[_s.mode == 'mix' ? "addMixTags" : "addTags"]([tagData || this.input.raw.call(this)], clearOnSelect)
this[isMixMode ? "addMixTags" : "addTags"]([tagData || this.input.raw.call(this)], clearOnSelect)
}

// todo: consider not doing this on mix-mode
if( !this.DOM.input.parentNode )
if( !isMixMode && !this.DOM.input.parentNode )
return

setTimeout(() => {
Expand Down

0 comments on commit 57cb194

Please sign in to comment.