@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/lib/SelectBox.js CHANGED
@@ -1479,7 +1479,8 @@ class SelectBox {
1479
1479
 
1480
1480
  this._trigger('open:before', { list: p.dropList });
1481
1481
 
1482
- p.lastActiveElement = document.activeElement === document.body ? null : getFocusState(document.activeElement);
1482
+ if (document.activeElement !== p.input)
1483
+ p.lastActiveElement = document.activeElement === document.body ? null : getFocusState(document.activeElement);
1483
1484
 
1484
1485
  // Propagate direction to droplist
1485
1486
  p.dropList.setDirection(getComputedStyle(p.el).direction);
@@ -1516,7 +1517,8 @@ class SelectBox {
1516
1517
  p.dropList.hide();
1517
1518
 
1518
1519
  if (p.lastActiveElement) {
1519
- restoreFocusState(p.lastActiveElement);
1520
+ if (!p.multi && !p.searchable)
1521
+ restoreFocusState(p.lastActiveElement);
1520
1522
  p.lastActiveElement = null;
1521
1523
  }
1522
1524
 
@@ -3307,10 +3309,12 @@ class SelectBox {
3307
3309
  event.preventDefault();
3308
3310
  } else if (event.key === VALUE_BACK_SPACE && target.value.length === 0) {
3309
3311
  const itemEl = p.multiItemEls[p.multiItemEls.length - 1];
3310
- if (!itemEl || itemEl[ItemSymbol].value === undefined)
3312
+ if (!itemEl)
3311
3313
  return;
3312
3314
 
3313
3315
  const item = itemEl[ItemSymbol], value = item[p.valueProp];
3316
+ if (value === undefined)
3317
+ return;
3314
3318
 
3315
3319
  let removeselEvt = { value: value, item: item, cancel: false };
3316
3320
  this._trigger('removesel:before', removeselEvt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danielgindi/selectbox",
3
- "version": "2.0.49",
3
+ "version": "2.0.51",
4
4
  "description": "A collection of dom utilities. So you can work natively with the dom without dom frameworks.",
5
5
  "main": "dist/lib.cjs.min.js",
6
6
  "module": "lib/index.js",