@syncfusion/ej2-navigations 20.4.42 → 20.4.44

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.
@@ -1415,14 +1415,6 @@ let MenuBase = class MenuBase extends Component {
1415
1415
  if (fliIdx === (e.action === DOWNARROW ? cul.childElementCount : -1)) {
1416
1416
  fliIdx = defaultIdx;
1417
1417
  }
1418
- if (cul.children[fliIdx].classList.contains(HIDE)) {
1419
- if (e.action === DOWNARROW && fliIdx === cul.childElementCount - 1) {
1420
- fliIdx = defaultIdx;
1421
- }
1422
- else if (e.action === UPARROW && fliIdx === 0) {
1423
- fliIdx = defaultIdx;
1424
- }
1425
- }
1426
1418
  }
1427
1419
  }
1428
1420
  const cli = cul.children[fliIdx];
@@ -1432,8 +1424,15 @@ let MenuBase = class MenuBase extends Component {
1432
1424
  }
1433
1425
  isValidLI(cli, index, action) {
1434
1426
  const cul = this.getUlByNavIdx();
1427
+ const defaultIdx = (action === DOWNARROW || action === HOME || action === TAB) ? 0 : cul.childElementCount - 1;
1435
1428
  if (cli.classList.contains(SEPARATOR) || cli.classList.contains(DISABLED) || cli.classList.contains(HIDE)) {
1436
- if ((action === DOWNARROW) || (action === RIGHTARROW)) {
1429
+ if (action === DOWNARROW && index === cul.childElementCount - 1) {
1430
+ index = defaultIdx;
1431
+ }
1432
+ else if (action === UPARROW && index === 0) {
1433
+ index = defaultIdx;
1434
+ }
1435
+ else if ((action === DOWNARROW) || (action === RIGHTARROW)) {
1437
1436
  index++;
1438
1437
  }
1439
1438
  else {
@@ -1593,11 +1592,15 @@ let MenuBase = class MenuBase extends Component {
1593
1592
  closedLi = trgtpopUp.querySelector('[id="' + trgtliId + '"]');
1594
1593
  trgtLi = (liElem && trgtpopUp.querySelector('[id="' + liElem.id + '"]'));
1595
1594
  }
1595
+ else if (trgtpopUp) {
1596
+ closedLi = trgtpopUp.querySelector('.e-menu-item.e-selected');
1597
+ trgtLi = (liElem && trgtpopUp.querySelector('[id="' + liElem.id + '"]'));
1598
+ }
1596
1599
  const submenus = liElem && liElem.querySelectorAll('.e-menu-item');
1597
1600
  if (isOpen && this.hamburgerMode && ulIndex && !(submenus.length)) {
1598
1601
  this.afterCloseMenu(e);
1599
1602
  }
1600
- else if (isOpen && !this.hamburgerMode && this.navIdx.length && closedLi && !trgtLi && this.keyType !== 'left') {
1603
+ else if (isOpen && !this.hamburgerMode && closedLi && !trgtLi && this.keyType !== 'left' && (this.navIdx.length || !this.isMenu && this.navIdx.length === 0)) {
1601
1604
  let ele = (e && e.target.classList.contains('e-vscroll'))
1602
1605
  ? closest(e.target, '.e-menu-wrapper') : null;
1603
1606
  if (ele) {
@@ -1611,7 +1614,7 @@ let MenuBase = class MenuBase extends Component {
1611
1614
  }
1612
1615
  }
1613
1616
  else if (isOpen && !isIterated && !ulIndex && ((this.hamburgerMode && this.navIdx.length) ||
1614
- this.navIdx.length === 1)) {
1617
+ this.navIdx.length === 1 && liElem && trgtpopUp !== liElem.parentElement)) {
1615
1618
  this.closeMenu(null, e);
1616
1619
  }
1617
1620
  else if (isOpen && isNullOrUndefined(ulIndex) && this.navIdx.length) {
@@ -7332,9 +7335,7 @@ let Tab = class Tab extends Component {
7332
7335
  this.tbObj = null;
7333
7336
  }
7334
7337
  this.unWireEvents();
7335
- ['role', 'aria-disabled', 'aria-activedescendant', 'tabindex', 'aria-orientation', 'aria-owns'].forEach((val) => {
7336
- this.element.removeAttribute(val);
7337
- });
7338
+ this.element.removeAttribute('aria-disabled');
7338
7339
  this.expTemplateContent();
7339
7340
  if (!this.isTemplate) {
7340
7341
  while (this.element.firstElementChild) {
@@ -7413,7 +7414,7 @@ let Tab = class Tab extends Component {
7413
7414
  const css = (name === 'msie') ? 'e-ie' : (name === 'edge') ? 'e-edge' : (name === 'safari') ? 'e-safari' : '';
7414
7415
  setStyleAttribute(this.element, { 'width': formatUnit(this.width), 'height': formatUnit(this.height) });
7415
7416
  this.setCssClass(this.element, this.cssClass, true);
7416
- attributes(this.element, { role: 'tablist', 'aria-disabled': 'false', 'aria-activedescendant': '', 'aria-owns': this.element.id + '_' + 'tab_header_items' });
7417
+ attributes(this.element, { 'aria-disabled': 'false' });
7417
7418
  this.setCssClass(this.element, css, true);
7418
7419
  this.updatePopAnimationConfig();
7419
7420
  }
@@ -7508,8 +7509,7 @@ let Tab = class Tab extends Component {
7508
7509
  hdrItems.forEach((item, index) => {
7509
7510
  this.lastIndex = index;
7510
7511
  const attr = {
7511
- className: CLS_ITEM$2, id: CLS_ITEM$2 + this.tabId + '_' + index,
7512
- attrs: { role: 'tab', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index, 'aria-selected': 'false' }
7512
+ className: CLS_ITEM$2, id: CLS_ITEM$2 + this.tabId + '_' + index
7513
7513
  };
7514
7514
  const txt = this.createElement('span', {
7515
7515
  className: CLS_TEXT, innerHTML: item, attrs: { 'role': 'presentation' }
@@ -7517,7 +7517,10 @@ let Tab = class Tab extends Component {
7517
7517
  const cont = this.createElement('div', {
7518
7518
  className: CLS_TEXT_WRAP, innerHTML: txt + this.btnCls.outerHTML
7519
7519
  }).outerHTML;
7520
- const wrap = this.createElement('div', { className: CLS_WRAP, innerHTML: cont, attrs: { tabIndex: '-1' } });
7520
+ const wrap = this.createElement('div', {
7521
+ className: CLS_WRAP, innerHTML: cont,
7522
+ attrs: { role: 'tab', tabIndex: '-1', 'aria-selected': 'false', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index }
7523
+ });
7521
7524
  tabItems.appendChild(this.createElement('div', attr));
7522
7525
  selectAll('.' + CLS_ITEM$2, tabItems)[index].appendChild(wrap);
7523
7526
  });
@@ -7536,15 +7539,13 @@ let Tab = class Tab extends Component {
7536
7539
  this.tbObj.isStringTemplate = true;
7537
7540
  this.tbObj.createElement = this.createElement;
7538
7541
  this.tbObj.appendTo(this.hdrEle);
7539
- attributes(this.hdrEle, { 'aria-label': 'tab-header' });
7540
- this.updateOrientationAttribute();
7542
+ attributes(this.hdrEle, { role: 'tablist' });
7541
7543
  this.setCloseButton(this.showCloseButton);
7542
7544
  const toolbarHeader = this.tbObj.element.querySelector('.' + CLS_TB_ITEMS);
7543
7545
  if (!isNullOrUndefined(toolbarHeader)) {
7544
7546
  if (isNullOrUndefined(toolbarHeader.id) || toolbarHeader.id === '') {
7545
7547
  toolbarHeader.id = this.element.id + '_' + 'tab_header_items';
7546
7548
  }
7547
- this.element.setAttribute('aria-owns', toolbarHeader.id);
7548
7549
  }
7549
7550
  }
7550
7551
  renderContent() {
@@ -7638,7 +7639,7 @@ let Tab = class Tab extends Component {
7638
7639
  }
7639
7640
  }
7640
7641
  const tabIndex = isNullOrUndefined(item.tabIndex) ? '-1' : item.tabIndex.toString();
7641
- const wrapAttrs = (item.disabled) ? {} : { tabIndex: tabIndex, 'data-tabindex': tabIndex };
7642
+ const wrapAttrs = (item.disabled) ? {} : { tabIndex: tabIndex, 'data-tabindex': tabIndex, role: 'tab', 'aria-selected': 'false' };
7642
7643
  tCont.appendChild(this.btnCls.cloneNode(true));
7643
7644
  const wrap = this.createElement('div', { className: CLS_WRAP, attrs: wrapAttrs });
7644
7645
  wrap.appendChild(tCont);
@@ -7649,7 +7650,7 @@ let Tab = class Tab extends Component {
7649
7650
  this.itemIndexArray.splice((index + i), 0, CLS_ITEM$2 + this.tabId + '_' + this.lastIndex);
7650
7651
  }
7651
7652
  const attrObj = {
7652
- id: CLS_ITEM$2 + this.tabId + '_' + this.lastIndex, role: 'tab', 'aria-selected': 'false'
7653
+ id: CLS_ITEM$2 + this.tabId + '_' + this.lastIndex
7653
7654
  };
7654
7655
  const tItem = { htmlAttributes: attrObj, template: wrap };
7655
7656
  tItem.cssClass = ((item.cssClass !== undefined) ? item.cssClass : ' ') + ' ' + disabled + ' ' + hidden + ' '
@@ -7678,6 +7679,7 @@ let Tab = class Tab extends Component {
7678
7679
  if (tabHeader) {
7679
7680
  const tabItems = selectAll('.' + CLS_TB_ITEM + '.' + CLS_ACTIVE$1, tabHeader);
7680
7681
  [].slice.call(tabItems).forEach((node) => node.classList.remove(CLS_ACTIVE$1));
7682
+ [].slice.call(tabItems).forEach((node) => node.firstElementChild.setAttribute('aria-selected', 'false'));
7681
7683
  }
7682
7684
  }
7683
7685
  checkPopupOverflow(ele) {
@@ -7720,9 +7722,6 @@ let Tab = class Tab extends Component {
7720
7722
  }
7721
7723
  return selectAll('.' + CLS_TB_ITEM, this.tbItems).length - 1;
7722
7724
  }
7723
- updateOrientationAttribute() {
7724
- attributes(this.element, { 'aria-orientation': (this.isVertical() ? 'vertical' : 'horizontal') });
7725
- }
7726
7725
  setCloseButton(val) {
7727
7726
  const trg = select('.' + CLS_HEADER$1, this.element);
7728
7727
  if (val === true) {
@@ -8026,7 +8025,6 @@ let Tab = class Tab extends Component {
8026
8025
  }
8027
8026
  }
8028
8027
  this.addVerticalClass();
8029
- this.updateOrientationAttribute();
8030
8028
  this.setActiveBorder();
8031
8029
  this.focusItem();
8032
8030
  }
@@ -8210,20 +8208,18 @@ let Tab = class Tab extends Component {
8210
8208
  if (!this.isTemplate) {
8211
8209
  const prev = this.tbItem[this.prevIndex];
8212
8210
  if (!isNullOrUndefined(prev)) {
8213
- prev.removeAttribute('aria-controls');
8211
+ prev.firstElementChild.removeAttribute('aria-controls');
8214
8212
  }
8215
- attributes(trg, { 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + value });
8213
+ attributes(trg.firstElementChild, { 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + value });
8216
8214
  }
8217
8215
  const id = trg.id;
8218
8216
  this.removeActiveClass();
8219
8217
  trg.classList.add(CLS_ACTIVE$1);
8220
- this.tbItem[this.prevIndex].setAttribute('aria-selected', 'false');
8221
- trg.setAttribute('aria-selected', 'true');
8218
+ trg.firstElementChild.setAttribute('aria-selected', 'true');
8222
8219
  const no = Number(this.extIndex(id));
8223
8220
  if (isNullOrUndefined(this.prevActiveEle)) {
8224
8221
  this.prevActiveEle = CLS_CONTENT$1 + this.tabId + '_' + no;
8225
8222
  }
8226
- attributes(this.element, { 'aria-activedescendant': id });
8227
8223
  if (this.isTemplate) {
8228
8224
  if (select('.' + CLS_CONTENT$1, this.element).children.length > 0) {
8229
8225
  const trg = this.findEle(select('.' + CLS_CONTENT$1, this.element).children, CLS_CONTENT$1 + this.tabId + '_' + no);
@@ -8892,7 +8888,7 @@ let Tab = class Tab extends Component {
8892
8888
  (textValue.length === 0) && !isNullOrUndefined(item.header) && isNullOrUndefined(item.header.iconCss))) {
8893
8889
  if (tabItems[place]) {
8894
8890
  if (isNullOrUndefined(item.id)) {
8895
- item.id = TABITEMPREFIX + (lastEleIndex + place).toString();
8891
+ item.id = CLS_ITEM$2 + this.tabId + '_' + TABITEMPREFIX + (lastEleIndex + place).toString();
8896
8892
  }
8897
8893
  tabItems[place].htmlAttributes['data-id'] = item.id;
8898
8894
  }
@@ -9319,7 +9315,7 @@ let Tab = class Tab extends Component {
9319
9315
  }
9320
9316
  }
9321
9317
  const tabIndex = isNullOrUndefined(item.tabIndex) ? '-1' : item.tabIndex.toString();
9322
- const wrapAtt = (item.disabled) ? {} : { tabIndex: tabIndex, 'data-tabindex': tabIndex };
9318
+ const wrapAtt = (item.disabled) ? {} : { tabIndex: tabIndex, 'data-tabindex': tabIndex, role: 'tab', 'aria-selected': 'true' };
9323
9319
  tConts.appendChild(this.btnCls.cloneNode(true));
9324
9320
  const wraper = this.createElement('div', { className: CLS_WRAP, attrs: wrapAtt });
9325
9321
  wraper.appendChild(tConts);
@@ -9370,11 +9366,7 @@ let Tab = class Tab extends Component {
9370
9366
  detach(element);
9371
9367
  detach(detachContent);
9372
9368
  const attr = {
9373
- className: CLS_TB_ITEM + ' ' + CLS_TEMPLATE$1 + ' ' + CLS_ACTIVE$1, id: CLS_ITEM$2 + this.tabId + '_' + index,
9374
- attrs: {
9375
- role: 'tab', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index,
9376
- 'aria-disabled': 'false', 'aria-selected': 'true'
9377
- }
9369
+ className: CLS_TB_ITEM + ' ' + CLS_TEMPLATE$1 + ' ' + CLS_ACTIVE$1, id: CLS_ITEM$2 + this.tabId + '_' + index
9378
9370
  };
9379
9371
  const txtString = this.createElement('span', {
9380
9372
  className: CLS_TEXT, innerHTML: header, attrs: { 'role': 'presentation' }
@@ -9384,7 +9376,8 @@ let Tab = class Tab extends Component {
9384
9376
  }).outerHTML;
9385
9377
  const tabIndex = element.firstElementChild.getAttribute('data-tabindex');
9386
9378
  const wrap = this.createElement('div', {
9387
- className: CLS_WRAP, innerHTML: conte, attrs: { tabIndex: tabIndex, 'data-tabindex': tabIndex }
9379
+ className: CLS_WRAP, innerHTML: conte,
9380
+ attrs: { tabIndex: tabIndex, 'data-tabindex': tabIndex, role: 'tab', 'aria-controls': CLS_CONTENT$1 + this.tabId + '_' + index, 'aria-selected': 'true' }
9388
9381
  });
9389
9382
  tabItems.insertBefore(this.createElement('div', attr), tabItems.children[index + 1]);
9390
9383
  this.element.querySelector('.' + CLS_TB_ITEM + '.' + CLS_ACTIVE$1).appendChild(wrap);
@@ -10928,7 +10921,7 @@ let TreeView = TreeView_1 = class TreeView extends Component {
10928
10921
  }
10929
10922
  }
10930
10923
  clickHandler(event) {
10931
- let target = event.originalEvent.target;
10924
+ let target = Browser.isDevice ? document.elementFromPoint(event.originalEvent.changedTouches[0].clientX, event.originalEvent.changedTouches[0].clientY) : event.originalEvent.target;
10932
10925
  EventHandler.remove(this.element, 'contextmenu', this.preventContextMenu);
10933
10926
  if (!target || this.dragStartAction) {
10934
10927
  return;