@danielgindi/selectbox 2.0.46 → 2.0.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lib.umd.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 2.0.46
2
+ * @danielgindi/selectbox 2.0.48
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  (function (global, factory) {
@@ -6929,7 +6929,7 @@
6929
6929
  return this;
6930
6930
  }
6931
6931
 
6932
- triggerItemSelection(item, event) {var _item$ItemSymbol3;
6932
+ triggerItemSelection(item, event) {
6933
6933
  const p = this._p;
6934
6934
 
6935
6935
  p.focusItemEl = p.focusItemEl || Dom.closestUntil(event.target, 'li', p.el);
@@ -6942,16 +6942,20 @@
6942
6942
  return false;
6943
6943
  }
6944
6944
 
6945
- if (!p.multi) {
6945
+ if (p.multi) {
6946
+ if (this.hasFocusedItem()) {
6947
+ this.toggleFocusedItem();
6948
+ }
6949
+ } else {var _item$ItemSymbol3;
6946
6950
  this._setSingleSelectedItemEl(p.focusItemEl);
6947
- }
6948
6951
 
6949
- this._trigger('select', {
6950
- value: item ? item.value : undefined,
6951
- item: (_item$ItemSymbol3 = item[ItemSymbol]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
6952
- event: event,
6953
- el: p.focusItemEl
6954
- });
6952
+ this._trigger('select', {
6953
+ value: item ? item.value : undefined,
6954
+ item: (_item$ItemSymbol3 = item[ItemSymbol]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
6955
+ event: event,
6956
+ el: p.focusItemEl
6957
+ });
6958
+ }
6955
6959
 
6956
6960
  return true;
6957
6961
  }
@@ -8302,7 +8306,7 @@
8302
8306
  }
8303
8307
 
8304
8308
  hasFocusedItem() {
8305
- return this._p.focusItemIndex > -1;
8309
+ return this._p.focusItemIndex > -1 && this._p.focusItemIndex < this._p.items.length;
8306
8310
  }
8307
8311
 
8308
8312
  getFocusedItemIndex() {
@@ -8730,8 +8734,6 @@
8730
8734
  if (this[DestroyedSymbol$1])
8731
8735
  return;
8732
8736
 
8733
- this.toggleFocusedItem();
8734
-
8735
8737
  if (document.activeElement !== this.el && p.focusItemEl) {
8736
8738
  clearTimeout(p.blurTimer);
8737
8739
  }