mirror of
https://github.com/Choices-js/Choices.git
synced 2024-05-20 14:36:34 +02:00
Ensure select input stays focussed after custom choice entry
This commit is contained in:
parent
4ccf63cef7
commit
90abab9f56
|
@ -1033,8 +1033,8 @@ class Choices {
|
||||||
this._addItem(choice.value, choice.label, choice.id, choice.groupId);
|
this._addItem(choice.value, choice.label, choice.id, choice.groupId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._triggerChange(choice.value);
|
|
||||||
|
|
||||||
|
this._triggerChange(choice.value);
|
||||||
this.clearInput(this.passedElement);
|
this.clearInput(this.passedElement);
|
||||||
|
|
||||||
// We wont to close the dropdown if we are dealing with a single select box
|
// We wont to close the dropdown if we are dealing with a single select box
|
||||||
|
@ -1356,11 +1356,10 @@ class Choices {
|
||||||
};
|
};
|
||||||
|
|
||||||
const onEnterKey = () => {
|
const onEnterKey = () => {
|
||||||
|
|
||||||
if (hasActiveDropdown) {
|
if (hasActiveDropdown) {
|
||||||
const highlighted = this.dropdown.querySelector(`.${this.config.classNames.highlightedState}`);
|
const highlighted = this.dropdown.querySelector(`.${this.config.classNames.highlightedState}`);
|
||||||
|
|
||||||
// If we have a highlighted choice
|
// If we have a highlighted choice, select it
|
||||||
if (highlighted) {
|
if (highlighted) {
|
||||||
this._handleChoiceAction(activeItems, highlighted);
|
this._handleChoiceAction(activeItems, highlighted);
|
||||||
}
|
}
|
||||||
|
@ -1387,7 +1386,7 @@ class Choices {
|
||||||
this._addItem(value);
|
this._addItem(value);
|
||||||
} else {
|
} else {
|
||||||
this._addChoice(true, false, value, value);
|
this._addChoice(true, false, value, value);
|
||||||
console.log(this.store.getState());
|
this.containerOuter.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
this._triggerChange(value);
|
this._triggerChange(value);
|
||||||
|
|
Loading…
Reference in a new issue