Skip to content

Commit

Permalink
re-implemented #1425 in a better way
Browse files Browse the repository at this point in the history
  • Loading branch information
yairEO committed Dec 21, 2024
1 parent 108c6bc commit 3e9819a
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/tagify.js
Original file line number Diff line number Diff line change
Expand Up @@ -633,19 +633,21 @@ Tagify.prototype = {
return !!tagData.value
}

if( tagElm && veryfyTagTextProp() ){
tagElm = this.replaceTag(tagElm, tagData)
this.editTagToggleValidity(tagElm, tagData)

if( _s.a11y.focusableTags )
tagElm.focus()
else if( _s.mode != 'select' )
// place caret after edited tag
placeCaretAfterNode(tagElm)
}
if( tagElm && tagElm.parentNode ){
if( veryfyTagTextProp() ){
tagElm = this.replaceTag(tagElm, tagData)
this.editTagToggleValidity(tagElm, tagData)

if( _s.a11y.focusableTags )
tagElm.focus()
else if( _s.mode != 'select' )
// place caret after edited tag
placeCaretAfterNode(tagElm)
}

else if(tagElm)
this.removeTags(tagElm)
else
this.removeTags(tagElm)
}

this.trigger("edit:updated", eventData)
this.dropdown.hide()
Expand Down

0 comments on commit 3e9819a

Please sign in to comment.