@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.
@@ -748,6 +748,11 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
748
748
  if (e.target === this.element && (e.keyCode === 9 || (!e.altKey && e.keyCode === 40) || e.keyCode === 38)) {
749
749
  return;
750
750
  }
751
+ var splitButton = getComponent(this.activeElem[0], 'split-btn');
752
+ if (splitButton && (e.keyCode === 13 || e.keyCode === 40 || e.keyCode === 38)) {
753
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
754
+ splitButton.issecondaryBtnClick = true;
755
+ }
751
756
  if (e.target && (e.target.classList.contains('e-item') || (e.target.parentElement && e.target.parentElement.classList.contains('e-split-btn-wrapper'))) && e.keyCode === 13) {
752
757
  e.preventDefault();
753
758
  }
@@ -780,10 +785,13 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
780
785
  upDownKeyHandler(this.getULElement(), e.keyCode);
781
786
  };
782
787
  DropDownButton.prototype.keyEventHandler = function (e) {
788
+ var isSplitbutton = this.activeElem[0].classList.contains('e-split-btn');
783
789
  if (this.target && (e.keyCode === 13 || e.keyCode === 9)) {
784
- return;
790
+ if (!isSplitbutton) {
791
+ return;
792
+ }
785
793
  }
786
- if (e.keyCode === 13 && this.activeElem[0].classList.contains('e-split-btn')) {
794
+ if (e.keyCode === 13 && isSplitbutton) {
787
795
  this.triggerSelect(e);
788
796
  this.activeElem[0].focus();
789
797
  return;
@@ -831,6 +839,11 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
831
839
  }
832
840
  };
833
841
  DropDownButton.prototype.clickHandler = function (e) {
842
+ var splitButton = getComponent(this.activeElem[0], 'split-btn');
843
+ if (splitButton) {
844
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
845
+ splitButton.issecondaryBtnClick = false;
846
+ }
834
847
  var trgt = e.target;
835
848
  if (closest(trgt, '[id="' + this.element.id + '"]')) {
836
849
  if (!this.createPopupOnClick || (this.target && this.target !== '' && !this.isColorPicker() && !this.createPopupOnClick)) {
@@ -909,6 +922,7 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
909
922
  }
910
923
  }
911
924
  var ul = this.getULElement();
925
+ var isSplitbutton = Boolean(this.element.parentElement && this.element.parentElement.classList.contains('e-split-btn-wrapper'));
912
926
  this.popupWireEvents();
913
927
  var beforeOpenArgs = { element: ul, items: this.items, event: e, cancel: false };
914
928
  this.trigger('beforeOpen', beforeOpenArgs, function (observedArgs) {
@@ -926,11 +940,24 @@ var DropDownButton = /** @__PURE__ @class */ (function (_super) {
926
940
  _this.element.setAttribute('aria-expanded', 'true');
927
941
  _this.element.setAttribute('aria-owns', _this.getPopUpElement().id);
928
942
  if (ul_1 && !_this.isSafari()) {
929
- ul_1.focus({ preventScroll: observedArgs.preventScroll });
943
+ if (_this.target && isSplitbutton) {
944
+ if (ul_1.tagName === 'UL') {
945
+ ul_1.focus({ preventScroll: observedArgs.preventScroll });
946
+ }
947
+ else {
948
+ var focusableChild = ul_1.querySelector('ul');
949
+ if (focusableChild) {
950
+ focusableChild.focus({ preventScroll: observedArgs.preventScroll });
951
+ }
952
+ }
953
+ }
954
+ else {
955
+ ul_1.focus({ preventScroll: observedArgs.preventScroll });
956
+ }
930
957
  }
931
958
  if (_this.enableRtl && ul_1.parentElement.style.left !== '0px') {
932
959
  var wrapperWidth = void 0;
933
- if (_this.element.parentElement && _this.element.parentElement.classList.contains('e-split-btn-wrapper')) {
960
+ if (isSplitbutton) {
934
961
  wrapperWidth = _this.element.parentElement.offsetWidth;
935
962
  }
936
963
  else {
@@ -1231,7 +1258,9 @@ var SplitButton = /** @__PURE__ @class */ (function (_super) {
1231
1258
  * @hidden
1232
1259
  */
1233
1260
  function SplitButton(options, element) {
1234
- return _super.call(this, options, element) || this;
1261
+ var _this = _super.call(this, options, element) || this;
1262
+ _this.issecondaryBtnClick = false;
1263
+ return _this;
1235
1264
  }
1236
1265
  /**
1237
1266
  * Initialize Angular support.
@@ -1485,16 +1514,20 @@ var SplitButton = /** @__PURE__ @class */ (function (_super) {
1485
1514
  SplitButton.prototype.btnKeyBoardHandler = function (e) {
1486
1515
  switch (e.action) {
1487
1516
  case 'altdownarrow':
1488
- this.clickHandler(e);
1517
+ if (this.issecondaryBtnClick) {
1518
+ this.clickHandler(e);
1519
+ }
1489
1520
  break;
1490
1521
  case 'enter':
1491
- this.clickHandler(e);
1492
- if (this.getPopUpElement() && !this.getPopUpElement().classList.contains('e-popup-close')) {
1493
- this.element.classList.remove('e-active');
1494
- this.secondaryBtnObj.element.classList.add('e-active');
1495
- }
1496
- else {
1497
- this.secondaryBtnObj.element.classList.remove('e-active');
1522
+ if (this.issecondaryBtnClick) {
1523
+ this.clickHandler(e);
1524
+ if (this.getPopUpElement() && !this.getPopUpElement().classList.contains('e-popup-close')) {
1525
+ this.element.classList.remove('e-active');
1526
+ this.secondaryBtnObj.element.classList.add('e-active');
1527
+ }
1528
+ else {
1529
+ this.secondaryBtnObj.element.classList.remove('e-active');
1530
+ }
1498
1531
  }
1499
1532
  break;
1500
1533
  }