From 29a8fe9f137e2afae23e485e13b5a0c6e57319c1 Mon Sep 17 00:00:00 2001 From: Massi-X Date: Sun, 24 Nov 2024 14:00:55 +0100 Subject: [PATCH] Revert "Fix delete key behavior in select mode" This reverts commit 542e73e4ea21e963026b1571f4f0e6a3b268ec91. --- src/parts/events.js | 5 ----- src/parts/suggestions.js | 7 +------ 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/src/parts/events.js b/src/parts/events.js index 8a158f5c..6e1432b1 100644 --- a/src/parts/events.js +++ b/src/parts/events.js @@ -168,9 +168,6 @@ export default { // if clicked anywhere else inside a tag, which had triggered an `focusin` event, // the onFocusBlur should be aborted. This part was spcifically written for `select` mode. // tagTextNode && this.events.callbacks.onEditTagFocus.call(this, nodeTag) - - // this fixes select mode input focus lost, to trigger: Tab into it, delete (backspace) without moving caret - _s.mode == 'select' && this.events.callbacks.onEditTagFocus.call(this, nodeTag) } var text = e.target ? this.trim(this.DOM.input.textContent) : '', // a string @@ -253,8 +250,6 @@ export default { // if nothing has changed (same display value), do not add a tag if( currentDisplayValue === text ) text = '' - else //the input is empty, we should now remove the tag - this.removeTags() } shouldAddTags = text && !this.state.actions.selectOption && _s.addTagOnBlur && _s.addTagOn.includes('blur'); diff --git a/src/parts/suggestions.js b/src/parts/suggestions.js index 1b516d3e..5be61569 100644 --- a/src/parts/suggestions.js +++ b/src/parts/suggestions.js @@ -296,14 +296,9 @@ export default { tagData = this.suggestedListItems.find(item => (item.value ?? item) == value) // select mode: reset the dropdown to show all options again to the user - _s.mode == 'select' && setTimeout(() => this.dropdown.show(), 0) - - // select mode: after the tag has been removed and focus is lost, trying to click a suggestion (after focusing again) will fail because it tries to replace an inexistent tag - // catch and use addTags() instead. This happens only once if(_s.mode == 'select' && !this.state.composing && this.userInput) { - this.addTags(value, true) setTimeout(() => { - closeOnSelect && this.dropdown.hide() + setTimeout(() => closeOnSelect ? this.dropdown.hide() : this.dropdown.show(), 0) this.DOM.scope.querySelector('.' + _s.classNames.tagText).focus() //set the focus back to input on each select to ensure consistent behavior }, 0) return;