Skip to content

Commit

Permalink
[bugfix] select-mode should not re-show the dropdown once an option h…
Browse files Browse the repository at this point in the history
…as been selected using the keyboard
  • Loading branch information
yairEO committed Apr 23, 2024
1 parent ff37bbf commit 4d3edf0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/tagify.js
Expand Up @@ -513,11 +513,12 @@ Tagify.prototype = {
tagIdx = this.getNodeIndex(tagElm),
tagData = getSetTagData(tagElm),
_CB = this.events.callbacks,
isValid = true
isValid = true,
isSelectMode = _s.mode == 'select'

// select mode is a bit different as clicking the tagify's content once will get into edit-mode if a value
// is already selected, and there cannot be a dropdown already open at this point.
_s.mode != 'select' && this.dropdown.hide()
!isSelectMode && this.dropdown.hide()

if( !editableElm ){
logger.warn('Cannot find element in Tag template: .', _s.classNames.tagTextSelector);
Expand Down Expand Up @@ -556,7 +557,7 @@ Tagify.prototype = {
editableElm.focus()
this.setRangeAtStartEnd(false, editableElm) // place the caret at the END of the editable tag text

_s.dropdown.enabled === 0 && this.dropdown.show()
_s.dropdown.enabled === 0 && !isSelectMode && this.dropdown.show()
this.state.hasFocus = true

return this
Expand Down

0 comments on commit 4d3edf0

Please sign in to comment.