@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.
@@ -1142,6 +1142,7 @@ let MenuBase = class MenuBase extends Component {
1142
1142
  this.isOpenCalled = false;
1143
1143
  this.isAnimationNone = false;
1144
1144
  this.isKBDAction = false;
1145
+ this.skipNextArrowDown = false;
1145
1146
  }
1146
1147
  /**
1147
1148
  * Initialized third party configuration settings.
@@ -1247,7 +1248,8 @@ let MenuBase = class MenuBase extends Component {
1247
1248
  this.element.parentElement.insertBefore(wrapper, this.element);
1248
1249
  }
1249
1250
  else {
1250
- document.body.appendChild(wrapper);
1251
+ const appendToElement = this.getAppendToElement();
1252
+ appendToElement.appendChild(wrapper);
1251
1253
  }
1252
1254
  }
1253
1255
  if (this.cssClass) {
@@ -1383,8 +1385,38 @@ let MenuBase = class MenuBase extends Component {
1383
1385
  e.action = ESCAPE;
1384
1386
  this.leftEscKeyHandler(e);
1385
1387
  }
1388
+ const isDown = e.key ? (e.key === 'ArrowDown') : e.keyCode === 40;
1389
+ if (!isDown) {
1390
+ return;
1391
+ }
1392
+ const hostPopup = closest(this.element, '.e-popup-open');
1393
+ if (!hostPopup) {
1394
+ return;
1395
+ }
1396
+ if (closest(document.activeElement, '#' + this.element.id)) {
1397
+ return;
1398
+ }
1399
+ const active = document.activeElement;
1400
+ if (!active) {
1401
+ return;
1402
+ }
1403
+ const expanded = active.getAttribute('aria-expanded') === 'true';
1404
+ if (!expanded) {
1405
+ return;
1406
+ }
1407
+ const ul = this.element;
1408
+ const firstItem = select('.e-menu-item', ul);
1409
+ if (firstItem) {
1410
+ ul.focus();
1411
+ firstItem.classList.add('e-focused');
1412
+ this.skipNextArrowDown = true;
1413
+ }
1386
1414
  }
1387
1415
  keyBoardHandler(e) {
1416
+ if (e.action === DOWNARROW && this.skipNextArrowDown) {
1417
+ this.skipNextArrowDown = false;
1418
+ return;
1419
+ }
1388
1420
  let actionName = '';
1389
1421
  const trgt = e.target;
1390
1422
  let actionNeeded = this.isMenu && !this.hamburgerMode && !this.element.classList.contains('e-vertical')
@@ -1484,6 +1516,9 @@ let MenuBase = class MenuBase extends Component {
1484
1516
  fliIdx = this.isValidLI(cli, fliIdx, e.action);
1485
1517
  cul.children[fliIdx].classList.add(FOCUSED);
1486
1518
  cul.children[fliIdx].focus();
1519
+ if (closest(this.element, '.e-popup')) {
1520
+ cul.focus();
1521
+ }
1487
1522
  }
1488
1523
  isValidLI(cli, index, action) {
1489
1524
  const cul = this.getUlByNavIdx();
@@ -1525,7 +1560,8 @@ let MenuBase = class MenuBase extends Component {
1525
1560
  return isNullOrUndefined(popup) ? null : select('.e-menu-parent', popup);
1526
1561
  }
1527
1562
  else {
1528
- if (!document.body.contains(this.element) && navIdxLen === 0) {
1563
+ const appendToElement = this.getAppendToElement();
1564
+ if (!appendToElement.contains(this.element) && navIdxLen === 0) {
1529
1565
  return null;
1530
1566
  }
1531
1567
  return this.getWrapper().children[navIdxLen];
@@ -1872,7 +1908,8 @@ let MenuBase = class MenuBase extends Component {
1872
1908
  li.appendChild(this.popupWrapper);
1873
1909
  }
1874
1910
  else {
1875
- document.body.appendChild(this.popupWrapper);
1911
+ const appendToElement = this.getAppendToElement();
1912
+ appendToElement.appendChild(this.popupWrapper);
1876
1913
  }
1877
1914
  this.isNestedOrVertical = this.element.classList.contains('e-vertical') || this.navIdx.length !== 1;
1878
1915
  this.popupObj = this.generatePopup(this.popupWrapper, this.uList, li, this.isNestedOrVertical);
@@ -3151,6 +3188,16 @@ let MenuBase = class MenuBase extends Component {
3151
3188
  }
3152
3189
  }
3153
3190
  }
3191
+ getAppendToElement() {
3192
+ if (this.isAngular) {
3193
+ const cdkPane = this.element.closest('.cdk-overlay-pane');
3194
+ const popoverEl = this.element.closest('[popover]');
3195
+ if (cdkPane && popoverEl) {
3196
+ return cdkPane;
3197
+ }
3198
+ }
3199
+ return document.body;
3200
+ }
3154
3201
  /**
3155
3202
  * Get the properties to be maintained in the persisted state.
3156
3203
  *