@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.cjs.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
  'use strict';
@@ -6933,7 +6933,7 @@ class DropList {
6933
6933
  return this;
6934
6934
  }
6935
6935
 
6936
- triggerItemSelection(item, event) {var _item$ItemSymbol3;
6936
+ triggerItemSelection(item, event) {
6937
6937
  const p = this._p;
6938
6938
 
6939
6939
  p.focusItemEl = p.focusItemEl || Dom.closestUntil(event.target, 'li', p.el);
@@ -6946,16 +6946,20 @@ class DropList {
6946
6946
  return false;
6947
6947
  }
6948
6948
 
6949
- if (!p.multi) {
6949
+ if (p.multi) {
6950
+ if (this.hasFocusedItem()) {
6951
+ this.toggleFocusedItem();
6952
+ }
6953
+ } else {var _item$ItemSymbol3;
6950
6954
  this._setSingleSelectedItemEl(p.focusItemEl);
6951
- }
6952
6955
 
6953
- this._trigger('select', {
6954
- value: item ? item.value : undefined,
6955
- item: (_item$ItemSymbol3 = item[ItemSymbol]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
6956
- event: event,
6957
- el: p.focusItemEl
6958
- });
6956
+ this._trigger('select', {
6957
+ value: item ? item.value : undefined,
6958
+ item: (_item$ItemSymbol3 = item[ItemSymbol]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
6959
+ event: event,
6960
+ el: p.focusItemEl
6961
+ });
6962
+ }
6959
6963
 
6960
6964
  return true;
6961
6965
  }
@@ -8306,7 +8310,7 @@ class DropList {
8306
8310
  }
8307
8311
 
8308
8312
  hasFocusedItem() {
8309
- return this._p.focusItemIndex > -1;
8313
+ return this._p.focusItemIndex > -1 && this._p.focusItemIndex < this._p.items.length;
8310
8314
  }
8311
8315
 
8312
8316
  getFocusedItemIndex() {
@@ -8734,8 +8738,6 @@ class DropList {
8734
8738
  if (this[DestroyedSymbol$1])
8735
8739
  return;
8736
8740
 
8737
- this.toggleFocusedItem();
8738
-
8739
8741
  if (document.activeElement !== this.el && p.focusItemEl) {
8740
8742
  clearTimeout(p.blurTimer);
8741
8743
  }