@danielgindi/selectbox 2.0.46 → 2.0.47

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.47
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,21 @@ class DropList {
6946
6946
  return false;
6947
6947
  }
6948
6948
 
6949
- if (!p.multi) {
6949
+ if (p.multi) {
6950
+ if (p.focusItemIndex >= 0) {
6951
+ this.toggleFocusedItem();
6952
+ event.preventDefault();
6953
+ }
6954
+ } else {var _item$ItemSymbol3;
6950
6955
  this._setSingleSelectedItemEl(p.focusItemEl);
6951
- }
6952
6956
 
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
- });
6957
+ this._trigger('select', {
6958
+ value: item ? item.value : undefined,
6959
+ item: (_item$ItemSymbol3 = item[ItemSymbol]) !== null && _item$ItemSymbol3 !== void 0 ? _item$ItemSymbol3 : item,
6960
+ event: event,
6961
+ el: p.focusItemEl
6962
+ });
6963
+ }
6959
6964
 
6960
6965
  return true;
6961
6966
  }
@@ -8306,7 +8311,7 @@ class DropList {
8306
8311
  }
8307
8312
 
8308
8313
  hasFocusedItem() {
8309
- return this._p.focusItemIndex > -1;
8314
+ return this._p.focusItemIndex > -1 && this._p.focusItemIndex < this._p.items.length;
8310
8315
  }
8311
8316
 
8312
8317
  getFocusedItemIndex() {