@syncfusion/ej2-splitbuttons 34.1.29 → 34.1.31

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.
@@ -704,6 +704,11 @@ let DropDownButton = class DropDownButton extends Component {
704
704
  if (e.target === this.element && (e.keyCode === 9 || (!e.altKey && e.keyCode === 40) || e.keyCode === 38)) {
705
705
  return;
706
706
  }
707
+ const splitButton = getComponent(this.activeElem[0], 'split-btn');
708
+ if (splitButton && (e.keyCode === 13 || e.keyCode === 40 || e.keyCode === 38)) {
709
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
710
+ splitButton.issecondaryBtnClick = true;
711
+ }
707
712
  if (e.target && (e.target.classList.contains('e-item') || (e.target.parentElement && e.target.parentElement.classList.contains('e-split-btn-wrapper'))) && e.keyCode === 13) {
708
713
  e.preventDefault();
709
714
  }
@@ -736,10 +741,13 @@ let DropDownButton = class DropDownButton extends Component {
736
741
  upDownKeyHandler(this.getULElement(), e.keyCode);
737
742
  }
738
743
  keyEventHandler(e) {
744
+ const isSplitbutton = this.activeElem[0].classList.contains('e-split-btn');
739
745
  if (this.target && (e.keyCode === 13 || e.keyCode === 9)) {
740
- return;
746
+ if (!isSplitbutton) {
747
+ return;
748
+ }
741
749
  }
742
- if (e.keyCode === 13 && this.activeElem[0].classList.contains('e-split-btn')) {
750
+ if (e.keyCode === 13 && isSplitbutton) {
743
751
  this.triggerSelect(e);
744
752
  this.activeElem[0].focus();
745
753
  return;
@@ -787,6 +795,11 @@ let DropDownButton = class DropDownButton extends Component {
787
795
  }
788
796
  }
789
797
  clickHandler(e) {
798
+ const splitButton = getComponent(this.activeElem[0], 'split-btn');
799
+ if (splitButton) {
800
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
801
+ splitButton.issecondaryBtnClick = false;
802
+ }
790
803
  const trgt = e.target;
791
804
  if (closest(trgt, '[id="' + this.element.id + '"]')) {
792
805
  if (!this.createPopupOnClick || (this.target && this.target !== '' && !this.isColorPicker() && !this.createPopupOnClick)) {
@@ -863,6 +876,7 @@ let DropDownButton = class DropDownButton extends Component {
863
876
  }
864
877
  }
865
878
  const ul = this.getULElement();
879
+ const isSplitbutton = Boolean(this.element.parentElement && this.element.parentElement.classList.contains('e-split-btn-wrapper'));
866
880
  this.popupWireEvents();
867
881
  const beforeOpenArgs = { element: ul, items: this.items, event: e, cancel: false };
868
882
  this.trigger('beforeOpen', beforeOpenArgs, (observedArgs) => {
@@ -880,11 +894,24 @@ let DropDownButton = class DropDownButton extends Component {
880
894
  this.element.setAttribute('aria-expanded', 'true');
881
895
  this.element.setAttribute('aria-owns', this.getPopUpElement().id);
882
896
  if (ul && !this.isSafari()) {
883
- ul.focus({ preventScroll: observedArgs.preventScroll });
897
+ if (this.target && isSplitbutton) {
898
+ if (ul.tagName === 'UL') {
899
+ ul.focus({ preventScroll: observedArgs.preventScroll });
900
+ }
901
+ else {
902
+ const focusableChild = ul.querySelector('ul');
903
+ if (focusableChild) {
904
+ focusableChild.focus({ preventScroll: observedArgs.preventScroll });
905
+ }
906
+ }
907
+ }
908
+ else {
909
+ ul.focus({ preventScroll: observedArgs.preventScroll });
910
+ }
884
911
  }
885
912
  if (this.enableRtl && ul.parentElement.style.left !== '0px') {
886
913
  let wrapperWidth;
887
- if (this.element.parentElement && this.element.parentElement.classList.contains('e-split-btn-wrapper')) {
914
+ if (isSplitbutton) {
888
915
  wrapperWidth = this.element.parentElement.offsetWidth;
889
916
  }
890
917
  else {
@@ -1168,6 +1195,7 @@ let SplitButton = class SplitButton extends DropDownButton {
1168
1195
  */
1169
1196
  constructor(options, element) {
1170
1197
  super(options, element);
1198
+ this.issecondaryBtnClick = false;
1171
1199
  }
1172
1200
  /**
1173
1201
  * Initialize Angular support.
@@ -1419,16 +1447,20 @@ let SplitButton = class SplitButton extends DropDownButton {
1419
1447
  btnKeyBoardHandler(e) {
1420
1448
  switch (e.action) {
1421
1449
  case 'altdownarrow':
1422
- this.clickHandler(e);
1450
+ if (this.issecondaryBtnClick) {
1451
+ this.clickHandler(e);
1452
+ }
1423
1453
  break;
1424
1454
  case 'enter':
1425
- this.clickHandler(e);
1426
- if (this.getPopUpElement() && !this.getPopUpElement().classList.contains('e-popup-close')) {
1427
- this.element.classList.remove('e-active');
1428
- this.secondaryBtnObj.element.classList.add('e-active');
1429
- }
1430
- else {
1431
- this.secondaryBtnObj.element.classList.remove('e-active');
1455
+ if (this.issecondaryBtnClick) {
1456
+ this.clickHandler(e);
1457
+ if (this.getPopUpElement() && !this.getPopUpElement().classList.contains('e-popup-close')) {
1458
+ this.element.classList.remove('e-active');
1459
+ this.secondaryBtnObj.element.classList.add('e-active');
1460
+ }
1461
+ else {
1462
+ this.secondaryBtnObj.element.classList.remove('e-active');
1463
+ }
1432
1464
  }
1433
1465
  break;
1434
1466
  }