Skip to content

Commit

Permalink
revert blur and focus on last chip delete (materializecss#24)
Browse files Browse the repository at this point in the history
Co-authored-by: zn022285 <[email protected]>
  • Loading branch information
2 people authored and Jay Dijkstra committed Mar 7, 2021
1 parent ea39d12 commit 2155552
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions js/chips.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@

if (currChips.chipsData.length) {
currChips.selectChip(selectIndex);
} else {
currChips.$input[0].focus();
}

// left arrow key
Expand Down Expand Up @@ -231,7 +233,7 @@
* @param {Event} e
*/
static _handleChipsBlur(e) {
if (!Chips._keydown) {
if (!Chips._keydown && document.hidden) {
let $chips = $(e.target).closest('.chips');
let currChips = $chips[0].M_Chips;

Expand Down Expand Up @@ -268,7 +270,7 @@
}

e.preventDefault();
if (!this.hasAutocomplete || (this.hasAutocomplete && !this.options.autocompleteOnly) ) {
if (!this.hasAutocomplete || (this.hasAutocomplete && !this.options.autocompleteOnly)) {
this.addChip({
tag: this.$input[0].value
});
Expand Down

0 comments on commit 2155552

Please sign in to comment.