@danielgindi/selectbox 1.0.132 → 1.0.133
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 +26 -4
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +26 -4
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +26 -4
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/lib/DropList.js +25 -3
- package/package.json +1 -1
package/lib/DropList.js
CHANGED
|
@@ -397,6 +397,24 @@ class DropList {
|
|
|
397
397
|
return false;
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
+
/**
|
|
401
|
+
* Returns true if document's active element is this droplist (or owned submenus)
|
|
402
|
+
* @param {boolean} [considerSubmenus=true]
|
|
403
|
+
* @returns {boolean}
|
|
404
|
+
*/
|
|
405
|
+
hasFocus(considerSubmenus = true) {
|
|
406
|
+
if (!document.activeElement)
|
|
407
|
+
return false;
|
|
408
|
+
|
|
409
|
+
if (document.activeElement.contains(this.el))
|
|
410
|
+
return true;
|
|
411
|
+
|
|
412
|
+
if (considerSubmenus && this._p.currentSubDropList?.droplist?.hasFocus())
|
|
413
|
+
return true;
|
|
414
|
+
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
|
|
400
418
|
/**
|
|
401
419
|
* @param {string|string[]} classes
|
|
402
420
|
* @returns {DropList}
|
|
@@ -1437,9 +1455,6 @@ class DropList {
|
|
|
1437
1455
|
})
|
|
1438
1456
|
.on('_back_key_pressed', () => {
|
|
1439
1457
|
this._hideSublist();
|
|
1440
|
-
|
|
1441
|
-
if (!this[DestroyedSymbol])
|
|
1442
|
-
this.el.focus();
|
|
1443
1458
|
});
|
|
1444
1459
|
|
|
1445
1460
|
droplist.setItems(item._subitems);
|
|
@@ -1475,10 +1490,17 @@ class DropList {
|
|
|
1475
1490
|
return;
|
|
1476
1491
|
|
|
1477
1492
|
const data = p.currentSubDropList;
|
|
1493
|
+
|
|
1494
|
+
let subHadFocus = data.droplist.hasFocus(true);
|
|
1495
|
+
|
|
1478
1496
|
data.droplist.hide();
|
|
1479
1497
|
data.droplist.destroy();
|
|
1480
1498
|
p.currentSubDropList = null;
|
|
1481
1499
|
|
|
1500
|
+
if (subHadFocus && !this[DestroyedSymbol]) {
|
|
1501
|
+
this.el.focus();
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1482
1504
|
this._trigger('hide_subitems', {
|
|
1483
1505
|
value: data.item.value,
|
|
1484
1506
|
item: data.item,
|
package/package.json
CHANGED