@syncfusion/ej2-calendars 33.2.12 → 33.2.15

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.
@@ -629,32 +629,29 @@ let CalendarBase = class CalendarBase extends Component {
629
629
  break;
630
630
  case 'tab':
631
631
  if (this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') {
632
- const hasToday = this.showTodayButton && !isNullOrUndefined(this.todayElement);
633
- const isLastFocusable = hasToday
634
- ? (e.target === this.todayElement)
635
- : (e.target === this.table);
636
- if (isLastFocusable) {
637
- e.preventDefault();
638
- if (this.isAngular) {
639
- this.inputElement.focus();
640
- }
641
- else {
642
- this.element.focus();
632
+ const popupEl = this.popupWrapper;
633
+ if (!isNullOrUndefined(popupEl)) {
634
+ const focusable = this.getPopupFocusableElements(popupEl);
635
+ const lastIndex = focusable.length - 1;
636
+ if (focusable.length > 0 && e.target === focusable[lastIndex]) {
637
+ e.preventDefault();
638
+ focusable[0].focus();
639
+ // popup stays open — no hide() call
643
640
  }
644
- this.hide();
645
641
  }
646
642
  }
647
643
  break;
648
644
  case 'shiftTab':
649
- if ((this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') && e.target === this.headerTitleElement) {
650
- e.preventDefault();
651
- if (this.isAngular) {
652
- this.inputElement.focus();
653
- }
654
- else {
655
- this.element.focus();
645
+ if (this.getModuleName() === 'datepicker' || this.getModuleName() === 'datetimepicker') {
646
+ const popupEl = this.popupWrapper;
647
+ if (!isNullOrUndefined(popupEl)) {
648
+ const focusable = this.getPopupFocusableElements(popupEl);
649
+ if (focusable.length > 0 && e.target === focusable[0]) {
650
+ e.preventDefault();
651
+ focusable[focusable.length - 1].focus();
652
+ // popup stays open — no hide() call
653
+ }
656
654
  }
657
- this.hide();
658
655
  }
659
656
  break;
660
657
  case 'escape':
@@ -664,6 +661,15 @@ let CalendarBase = class CalendarBase extends Component {
664
661
  break;
665
662
  }
666
663
  }
664
+ getPopupFocusableElements(container) {
665
+ const selector = [
666
+ 'button:not([disabled]):not([tabindex="-1"])',
667
+ 'td[tabindex="0"]:not([aria-disabled="true"])',
668
+ '[tabindex="0"]:not([disabled])'
669
+ ].join(', ');
670
+ return Array.from(container.querySelectorAll(selector))
671
+ .filter((el) => !isNullOrUndefined(el.offsetParent));
672
+ }
667
673
  keyboardNavigate(number, currentView, e, max, min) {
668
674
  const date = new Date(this.checkValue(this.currentDate));
669
675
  switch (currentView) {