Skip to content

Commit

Permalink
fixes #1400 - tyrping text in the input element and pressing backspac…
Browse files Browse the repository at this point in the history
…e key should not rmove everything that was typed
  • Loading branch information
yairEO committed Nov 10, 2024
1 parent 0e0e851 commit f0747d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/parts/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ export default {
}

shouldAddTags = text && !this.state.actions.selectOption && _s.addTagOnBlur && _s.addTagOn.includes('blur');

// do not add a tag if "selectOption" action was just fired (this means a tag was just added from the dropdown)
shouldAddTags && this.addTags(text, true)
}
Expand All @@ -276,11 +275,12 @@ export default {
var _s = this.settings,
focusedElm = document.activeElement,
withinTag = isWithinNodeTag.call(this, focusedElm),
isBelong = withinTag && this.DOM.scope.contains(document.activeElement),
isBelong = withinTag && this.DOM.scope.contains(focusedElm),
isInputNode = focusedElm === this.DOM.input,
isReadyOnlyTag = isBelong && focusedElm.hasAttribute('readonly'),
nextTag;

if( !this.state.hasFocus && (!isBelong || isReadyOnlyTag) ) return;
if( !this.state.hasFocus && (!isBelong || isReadyOnlyTag) || isInputNode ) return;

nextTag = focusedElm.nextElementSibling;

Expand Down

0 comments on commit f0747d1

Please sign in to comment.