@danielgindi/selectbox 2.0.49 → 2.0.51

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.49
2
+ * @danielgindi/selectbox 2.0.51
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -11289,6 +11289,7 @@ class SelectBox {
11289
11289
 
11290
11290
  this._trigger('open:before', { list: p.dropList });
11291
11291
 
11292
+ if (document.activeElement !== p.input)
11292
11293
  p.lastActiveElement = document.activeElement === document.body ? null : getFocusState(document.activeElement);
11293
11294
 
11294
11295
  // Propagate direction to droplist
@@ -11326,6 +11327,7 @@ class SelectBox {
11326
11327
  p.dropList.hide();
11327
11328
 
11328
11329
  if (p.lastActiveElement) {
11330
+ if (!p.multi && !p.searchable)
11329
11331
  restoreFocusState(p.lastActiveElement);
11330
11332
  p.lastActiveElement = null;
11331
11333
  }
@@ -13117,10 +13119,12 @@ class SelectBox {
13117
13119
  event.preventDefault();
13118
13120
  } else if (event.key === keycodeJs.VALUE_BACK_SPACE && target.value.length === 0) {
13119
13121
  const itemEl = p.multiItemEls[p.multiItemEls.length - 1];
13120
- if (!itemEl || itemEl[ItemSymbol].value === undefined)
13122
+ if (!itemEl)
13121
13123
  return;
13122
13124
 
13123
13125
  const item = itemEl[ItemSymbol],value = item[p.valueProp];
13126
+ if (value === undefined)
13127
+ return;
13124
13128
 
13125
13129
  let removeselEvt = { value: value, item: item, cancel: false };
13126
13130
  this._trigger('removesel:before', removeselEvt);