From 7f139574d43a1a823a95cfb9894b9b24e674dc6d Mon Sep 17 00:00:00 2001 From: Zach Nickel Date: Fri, 18 Sep 2020 10:50:46 -0500 Subject: [PATCH] revert blur and focus on last chip delete (#24) Co-authored-by: zn022285 --- js/chips.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/chips.js b/js/chips.js index 4165dc63a8..e29c328c3a 100644 --- a/js/chips.js +++ b/js/chips.js @@ -192,6 +192,8 @@ if (currChips.chipsData.length) { currChips.selectChip(selectIndex); + } else { + currChips.$input[0].focus(); } // left arrow key @@ -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; @@ -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 });