@syncfusion/ej2-navigations 32.2.7 → 32.2.8

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.
@@ -1215,6 +1215,7 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1215
1215
  _this.isOpenCalled = false;
1216
1216
  _this.isAnimationNone = false;
1217
1217
  _this.isKBDAction = false;
1218
+ _this.skipNextArrowDown = false;
1218
1219
  return _this;
1219
1220
  }
1220
1221
  /**
@@ -1322,7 +1323,8 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1322
1323
  this.element.parentElement.insertBefore(wrapper, this.element);
1323
1324
  }
1324
1325
  else {
1325
- document.body.appendChild(wrapper);
1326
+ var appendToElement = this.getAppendToElement();
1327
+ appendToElement.appendChild(wrapper);
1326
1328
  }
1327
1329
  }
1328
1330
  if (this.cssClass) {
@@ -1459,8 +1461,38 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1459
1461
  e.action = ESCAPE;
1460
1462
  this.leftEscKeyHandler(e);
1461
1463
  }
1464
+ var isDown = e.key ? (e.key === 'ArrowDown') : e.keyCode === 40;
1465
+ if (!isDown) {
1466
+ return;
1467
+ }
1468
+ var hostPopup = closest(this.element, '.e-popup-open');
1469
+ if (!hostPopup) {
1470
+ return;
1471
+ }
1472
+ if (closest(document.activeElement, '#' + this.element.id)) {
1473
+ return;
1474
+ }
1475
+ var active = document.activeElement;
1476
+ if (!active) {
1477
+ return;
1478
+ }
1479
+ var expanded = active.getAttribute('aria-expanded') === 'true';
1480
+ if (!expanded) {
1481
+ return;
1482
+ }
1483
+ var ul = this.element;
1484
+ var firstItem = select('.e-menu-item', ul);
1485
+ if (firstItem) {
1486
+ ul.focus();
1487
+ firstItem.classList.add('e-focused');
1488
+ this.skipNextArrowDown = true;
1489
+ }
1462
1490
  };
1463
1491
  MenuBase.prototype.keyBoardHandler = function (e) {
1492
+ if (e.action === DOWNARROW && this.skipNextArrowDown) {
1493
+ this.skipNextArrowDown = false;
1494
+ return;
1495
+ }
1464
1496
  var actionName = '';
1465
1497
  var trgt = e.target;
1466
1498
  var actionNeeded = this.isMenu && !this.hamburgerMode && !this.element.classList.contains('e-vertical')
@@ -1560,6 +1592,9 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1560
1592
  fliIdx = this.isValidLI(cli, fliIdx, e.action);
1561
1593
  cul.children[fliIdx].classList.add(FOCUSED);
1562
1594
  cul.children[fliIdx].focus();
1595
+ if (closest(this.element, '.e-popup')) {
1596
+ cul.focus();
1597
+ }
1563
1598
  };
1564
1599
  MenuBase.prototype.isValidLI = function (cli, index, action) {
1565
1600
  var cul = this.getUlByNavIdx();
@@ -1603,7 +1638,8 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1603
1638
  return isNullOrUndefined(popup) ? null : select('.e-menu-parent', popup);
1604
1639
  }
1605
1640
  else {
1606
- if (!document.body.contains(this.element) && navIdxLen === 0) {
1641
+ var appendToElement = this.getAppendToElement();
1642
+ if (!appendToElement.contains(this.element) && navIdxLen === 0) {
1607
1643
  return null;
1608
1644
  }
1609
1645
  return this.getWrapper().children[navIdxLen];
@@ -1959,7 +1995,8 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
1959
1995
  li.appendChild(this.popupWrapper);
1960
1996
  }
1961
1997
  else {
1962
- document.body.appendChild(this.popupWrapper);
1998
+ var appendToElement = this.getAppendToElement();
1999
+ appendToElement.appendChild(this.popupWrapper);
1963
2000
  }
1964
2001
  this.isNestedOrVertical = this.element.classList.contains('e-vertical') || this.navIdx.length !== 1;
1965
2002
  this.popupObj = this.generatePopup(this.popupWrapper, this.uList, li, this.isNestedOrVertical);
@@ -3260,6 +3297,16 @@ var MenuBase = /** @__PURE__ @class */ (function (_super) {
3260
3297
  }
3261
3298
  }
3262
3299
  };
3300
+ MenuBase.prototype.getAppendToElement = function () {
3301
+ if (this.isAngular) {
3302
+ var cdkPane = this.element.closest('.cdk-overlay-pane');
3303
+ var popoverEl = this.element.closest('[popover]');
3304
+ if (cdkPane && popoverEl) {
3305
+ return cdkPane;
3306
+ }
3307
+ }
3308
+ return document.body;
3309
+ };
3263
3310
  /**
3264
3311
  * Get the properties to be maintained in the persisted state.
3265
3312
  *