@aurodesignsystem-dev/auro-formkit 0.0.0-pr783.0 → 0.0.0-pr783.1

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.
@@ -1755,7 +1755,7 @@ class AuroFloatingUI {
1755
1755
  */
1756
1756
  mirrorSize() {
1757
1757
  // mirror the boxsize from bibSizer
1758
- if (this.element.bibSizer) {
1758
+ if (this.element.bibSizer && this.element.matchWidth) {
1759
1759
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1760
1760
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1761
1761
  if (sizerStyle.width !== '0px') {
@@ -1967,13 +1967,13 @@ class AuroFloatingUI {
1967
1967
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1968
1968
  return;
1969
1969
  }
1970
-
1970
+
1971
1971
  // if fullscreen bib is in fullscreen mode, do not close
1972
1972
  if (this.element.bib.hasAttribute('isfullscreen')) {
1973
1973
  return;
1974
1974
  }
1975
1975
 
1976
- this.hideBib();
1976
+ this.hideBib("keydown");
1977
1977
  }
1978
1978
 
1979
1979
  setupHideHandlers() {
@@ -1998,7 +1998,7 @@ class AuroFloatingUI {
1998
1998
  document.expandedAuroFormkitDropdown = null;
1999
1999
  document.expandedAuroFloater = this;
2000
2000
  } else {
2001
- this.hideBib();
2001
+ this.hideBib("click");
2002
2002
  }
2003
2003
  }
2004
2004
  };
@@ -2011,7 +2011,7 @@ class AuroFloatingUI {
2011
2011
  // if something else is open, let it handle itself
2012
2012
  return;
2013
2013
  }
2014
- this.hideBib();
2014
+ this.hideBib("keydown");
2015
2015
  }
2016
2016
  };
2017
2017
 
@@ -2094,7 +2094,11 @@ class AuroFloatingUI {
2094
2094
  }
2095
2095
  }
2096
2096
 
2097
- hideBib() {
2097
+ /**
2098
+ * Hides the floating UI element.
2099
+ * @param {String} eventType - The event type that triggered the hiding action.
2100
+ */
2101
+ hideBib(eventType = "unknown") {
2098
2102
  if (!this.element.disabled && !this.element.noToggle) {
2099
2103
  this.lockScroll(false);
2100
2104
  this.element.triggerChevron?.removeAttribute('data-expanded');
@@ -2105,7 +2109,7 @@ class AuroFloatingUI {
2105
2109
  if (this.showing) {
2106
2110
  this.cleanupHideHandlers();
2107
2111
  this.showing = false;
2108
- this.dispatchEventDropdownToggle();
2112
+ this.dispatchEventDropdownToggle(eventType);
2109
2113
  }
2110
2114
  }
2111
2115
  document.expandedAuroFloater = null;
@@ -2114,11 +2118,13 @@ class AuroFloatingUI {
2114
2118
  /**
2115
2119
  * @private
2116
2120
  * @returns {void} Dispatches event with an object showing the state of the dropdown.
2121
+ * @param {String} eventType - The event type that triggered the toggle action.
2117
2122
  */
2118
- dispatchEventDropdownToggle() {
2123
+ dispatchEventDropdownToggle(eventType) {
2119
2124
  const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
2120
2125
  detail: {
2121
2126
  expanded: this.showing,
2127
+ eventType: eventType || "unknown",
2122
2128
  },
2123
2129
  composed: true
2124
2130
  });
@@ -2128,7 +2134,7 @@ class AuroFloatingUI {
2128
2134
 
2129
2135
  handleClick() {
2130
2136
  if (this.element.isPopoverVisible) {
2131
- this.hideBib();
2137
+ this.hideBib("click");
2132
2138
  } else {
2133
2139
  this.showBib();
2134
2140
  }
@@ -2155,7 +2161,7 @@ class AuroFloatingUI {
2155
2161
 
2156
2162
  event.preventDefault();
2157
2163
  this.handleClick();
2158
- }
2164
+ }
2159
2165
  break;
2160
2166
  case 'mouseenter':
2161
2167
  if (this.element.hoverToggle) {
@@ -2164,7 +2170,7 @@ class AuroFloatingUI {
2164
2170
  break;
2165
2171
  case 'mouseleave':
2166
2172
  if (this.element.hoverToggle) {
2167
- this.hideBib();
2173
+ this.hideBib("mouseleave");
2168
2174
  }
2169
2175
  break;
2170
2176
  case 'focus':
@@ -3558,6 +3564,9 @@ class AuroDropdown extends AuroElement {
3558
3564
 
3559
3565
  this.parentBorder = false;
3560
3566
 
3567
+ /** @private */
3568
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3569
+
3561
3570
  this.privateDefaults();
3562
3571
  }
3563
3572
 
@@ -3991,12 +4000,19 @@ class AuroDropdown extends AuroElement {
3991
4000
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3992
4001
  this.handleTriggerContentSlotChange();
3993
4002
  }
4003
+ }
3994
4004
 
3995
- if (changedProperties.has('isPopoverVisible')) {
3996
- this.updateFocusTrap();
3997
- if (!this.isPopoverVisible && this.hasFocus) {
3998
- this.trigger.focus();
3999
- }
4005
+ /**
4006
+ * Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
4007
+ * @private
4008
+ * @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
4009
+ */
4010
+ handleDropdownToggle(event) {
4011
+ this.updateFocusTrap();
4012
+ this.isPopoverVisible = event.detail.expanded;
4013
+ const eventType = event.detail.eventType || "unknown";
4014
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
4015
+ this.trigger.focus();
4000
4016
  }
4001
4017
  }
4002
4018
 
@@ -4004,6 +4020,7 @@ class AuroDropdown extends AuroElement {
4004
4020
 
4005
4021
  // Configure the floater to, this will generate the ID for the bib
4006
4022
  this.floater.configure(this, 'auroDropdown');
4023
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
4007
4024
 
4008
4025
  /**
4009
4026
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -1730,7 +1730,7 @@ class AuroFloatingUI {
1730
1730
  */
1731
1731
  mirrorSize() {
1732
1732
  // mirror the boxsize from bibSizer
1733
- if (this.element.bibSizer) {
1733
+ if (this.element.bibSizer && this.element.matchWidth) {
1734
1734
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1735
1735
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1736
1736
  if (sizerStyle.width !== '0px') {
@@ -1942,13 +1942,13 @@ class AuroFloatingUI {
1942
1942
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1943
1943
  return;
1944
1944
  }
1945
-
1945
+
1946
1946
  // if fullscreen bib is in fullscreen mode, do not close
1947
1947
  if (this.element.bib.hasAttribute('isfullscreen')) {
1948
1948
  return;
1949
1949
  }
1950
1950
 
1951
- this.hideBib();
1951
+ this.hideBib("keydown");
1952
1952
  }
1953
1953
 
1954
1954
  setupHideHandlers() {
@@ -1973,7 +1973,7 @@ class AuroFloatingUI {
1973
1973
  document.expandedAuroFormkitDropdown = null;
1974
1974
  document.expandedAuroFloater = this;
1975
1975
  } else {
1976
- this.hideBib();
1976
+ this.hideBib("click");
1977
1977
  }
1978
1978
  }
1979
1979
  };
@@ -1986,7 +1986,7 @@ class AuroFloatingUI {
1986
1986
  // if something else is open, let it handle itself
1987
1987
  return;
1988
1988
  }
1989
- this.hideBib();
1989
+ this.hideBib("keydown");
1990
1990
  }
1991
1991
  };
1992
1992
 
@@ -2069,7 +2069,11 @@ class AuroFloatingUI {
2069
2069
  }
2070
2070
  }
2071
2071
 
2072
- hideBib() {
2072
+ /**
2073
+ * Hides the floating UI element.
2074
+ * @param {String} eventType - The event type that triggered the hiding action.
2075
+ */
2076
+ hideBib(eventType = "unknown") {
2073
2077
  if (!this.element.disabled && !this.element.noToggle) {
2074
2078
  this.lockScroll(false);
2075
2079
  this.element.triggerChevron?.removeAttribute('data-expanded');
@@ -2080,7 +2084,7 @@ class AuroFloatingUI {
2080
2084
  if (this.showing) {
2081
2085
  this.cleanupHideHandlers();
2082
2086
  this.showing = false;
2083
- this.dispatchEventDropdownToggle();
2087
+ this.dispatchEventDropdownToggle(eventType);
2084
2088
  }
2085
2089
  }
2086
2090
  document.expandedAuroFloater = null;
@@ -2089,11 +2093,13 @@ class AuroFloatingUI {
2089
2093
  /**
2090
2094
  * @private
2091
2095
  * @returns {void} Dispatches event with an object showing the state of the dropdown.
2096
+ * @param {String} eventType - The event type that triggered the toggle action.
2092
2097
  */
2093
- dispatchEventDropdownToggle() {
2098
+ dispatchEventDropdownToggle(eventType) {
2094
2099
  const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
2095
2100
  detail: {
2096
2101
  expanded: this.showing,
2102
+ eventType: eventType || "unknown",
2097
2103
  },
2098
2104
  composed: true
2099
2105
  });
@@ -2103,7 +2109,7 @@ class AuroFloatingUI {
2103
2109
 
2104
2110
  handleClick() {
2105
2111
  if (this.element.isPopoverVisible) {
2106
- this.hideBib();
2112
+ this.hideBib("click");
2107
2113
  } else {
2108
2114
  this.showBib();
2109
2115
  }
@@ -2130,7 +2136,7 @@ class AuroFloatingUI {
2130
2136
 
2131
2137
  event.preventDefault();
2132
2138
  this.handleClick();
2133
- }
2139
+ }
2134
2140
  break;
2135
2141
  case 'mouseenter':
2136
2142
  if (this.element.hoverToggle) {
@@ -2139,7 +2145,7 @@ class AuroFloatingUI {
2139
2145
  break;
2140
2146
  case 'mouseleave':
2141
2147
  if (this.element.hoverToggle) {
2142
- this.hideBib();
2148
+ this.hideBib("mouseleave");
2143
2149
  }
2144
2150
  break;
2145
2151
  case 'focus':
@@ -3533,6 +3539,9 @@ class AuroDropdown extends AuroElement {
3533
3539
 
3534
3540
  this.parentBorder = false;
3535
3541
 
3542
+ /** @private */
3543
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3544
+
3536
3545
  this.privateDefaults();
3537
3546
  }
3538
3547
 
@@ -3966,12 +3975,19 @@ class AuroDropdown extends AuroElement {
3966
3975
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3967
3976
  this.handleTriggerContentSlotChange();
3968
3977
  }
3978
+ }
3969
3979
 
3970
- if (changedProperties.has('isPopoverVisible')) {
3971
- this.updateFocusTrap();
3972
- if (!this.isPopoverVisible && this.hasFocus) {
3973
- this.trigger.focus();
3974
- }
3980
+ /**
3981
+ * Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
3982
+ * @private
3983
+ * @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
3984
+ */
3985
+ handleDropdownToggle(event) {
3986
+ this.updateFocusTrap();
3987
+ this.isPopoverVisible = event.detail.expanded;
3988
+ const eventType = event.detail.eventType || "unknown";
3989
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
3990
+ this.trigger.focus();
3975
3991
  }
3976
3992
  }
3977
3993
 
@@ -3979,6 +3995,7 @@ class AuroDropdown extends AuroElement {
3979
3995
 
3980
3996
  // Configure the floater to, this will generate the ID for the bib
3981
3997
  this.floater.configure(this, 'auroDropdown');
3998
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
3982
3999
 
3983
4000
  /**
3984
4001
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -220,6 +220,12 @@ export class AuroDropdown extends AuroElement {
220
220
  shape: any;
221
221
  size: any;
222
222
  parentBorder: boolean;
223
+ /**
224
+ * Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
225
+ * @private
226
+ * @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
227
+ */
228
+ private handleDropdownToggle;
223
229
  /**
224
230
  * @private
225
231
  * @returns {object} Class definition for the wrapper element.
@@ -1689,7 +1689,7 @@ class AuroFloatingUI {
1689
1689
  */
1690
1690
  mirrorSize() {
1691
1691
  // mirror the boxsize from bibSizer
1692
- if (this.element.bibSizer) {
1692
+ if (this.element.bibSizer && this.element.matchWidth) {
1693
1693
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1694
1694
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1695
1695
  if (sizerStyle.width !== '0px') {
@@ -1901,13 +1901,13 @@ class AuroFloatingUI {
1901
1901
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1902
1902
  return;
1903
1903
  }
1904
-
1904
+
1905
1905
  // if fullscreen bib is in fullscreen mode, do not close
1906
1906
  if (this.element.bib.hasAttribute('isfullscreen')) {
1907
1907
  return;
1908
1908
  }
1909
1909
 
1910
- this.hideBib();
1910
+ this.hideBib("keydown");
1911
1911
  }
1912
1912
 
1913
1913
  setupHideHandlers() {
@@ -1932,7 +1932,7 @@ class AuroFloatingUI {
1932
1932
  document.expandedAuroFormkitDropdown = null;
1933
1933
  document.expandedAuroFloater = this;
1934
1934
  } else {
1935
- this.hideBib();
1935
+ this.hideBib("click");
1936
1936
  }
1937
1937
  }
1938
1938
  };
@@ -1945,7 +1945,7 @@ class AuroFloatingUI {
1945
1945
  // if something else is open, let it handle itself
1946
1946
  return;
1947
1947
  }
1948
- this.hideBib();
1948
+ this.hideBib("keydown");
1949
1949
  }
1950
1950
  };
1951
1951
 
@@ -2028,7 +2028,11 @@ class AuroFloatingUI {
2028
2028
  }
2029
2029
  }
2030
2030
 
2031
- hideBib() {
2031
+ /**
2032
+ * Hides the floating UI element.
2033
+ * @param {String} eventType - The event type that triggered the hiding action.
2034
+ */
2035
+ hideBib(eventType = "unknown") {
2032
2036
  if (!this.element.disabled && !this.element.noToggle) {
2033
2037
  this.lockScroll(false);
2034
2038
  this.element.triggerChevron?.removeAttribute('data-expanded');
@@ -2039,7 +2043,7 @@ class AuroFloatingUI {
2039
2043
  if (this.showing) {
2040
2044
  this.cleanupHideHandlers();
2041
2045
  this.showing = false;
2042
- this.dispatchEventDropdownToggle();
2046
+ this.dispatchEventDropdownToggle(eventType);
2043
2047
  }
2044
2048
  }
2045
2049
  document.expandedAuroFloater = null;
@@ -2048,11 +2052,13 @@ class AuroFloatingUI {
2048
2052
  /**
2049
2053
  * @private
2050
2054
  * @returns {void} Dispatches event with an object showing the state of the dropdown.
2055
+ * @param {String} eventType - The event type that triggered the toggle action.
2051
2056
  */
2052
- dispatchEventDropdownToggle() {
2057
+ dispatchEventDropdownToggle(eventType) {
2053
2058
  const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
2054
2059
  detail: {
2055
2060
  expanded: this.showing,
2061
+ eventType: eventType || "unknown",
2056
2062
  },
2057
2063
  composed: true
2058
2064
  });
@@ -2062,7 +2068,7 @@ class AuroFloatingUI {
2062
2068
 
2063
2069
  handleClick() {
2064
2070
  if (this.element.isPopoverVisible) {
2065
- this.hideBib();
2071
+ this.hideBib("click");
2066
2072
  } else {
2067
2073
  this.showBib();
2068
2074
  }
@@ -2089,7 +2095,7 @@ class AuroFloatingUI {
2089
2095
 
2090
2096
  event.preventDefault();
2091
2097
  this.handleClick();
2092
- }
2098
+ }
2093
2099
  break;
2094
2100
  case 'mouseenter':
2095
2101
  if (this.element.hoverToggle) {
@@ -2098,7 +2104,7 @@ class AuroFloatingUI {
2098
2104
  break;
2099
2105
  case 'mouseleave':
2100
2106
  if (this.element.hoverToggle) {
2101
- this.hideBib();
2107
+ this.hideBib("mouseleave");
2102
2108
  }
2103
2109
  break;
2104
2110
  case 'focus':
@@ -3486,6 +3492,9 @@ class AuroDropdown extends AuroElement {
3486
3492
 
3487
3493
  this.parentBorder = false;
3488
3494
 
3495
+ /** @private */
3496
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3497
+
3489
3498
  this.privateDefaults();
3490
3499
  }
3491
3500
 
@@ -3919,12 +3928,19 @@ class AuroDropdown extends AuroElement {
3919
3928
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3920
3929
  this.handleTriggerContentSlotChange();
3921
3930
  }
3931
+ }
3922
3932
 
3923
- if (changedProperties.has('isPopoverVisible')) {
3924
- this.updateFocusTrap();
3925
- if (!this.isPopoverVisible && this.hasFocus) {
3926
- this.trigger.focus();
3927
- }
3933
+ /**
3934
+ * Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
3935
+ * @private
3936
+ * @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
3937
+ */
3938
+ handleDropdownToggle(event) {
3939
+ this.updateFocusTrap();
3940
+ this.isPopoverVisible = event.detail.expanded;
3941
+ const eventType = event.detail.eventType || "unknown";
3942
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
3943
+ this.trigger.focus();
3928
3944
  }
3929
3945
  }
3930
3946
 
@@ -3932,6 +3948,7 @@ class AuroDropdown extends AuroElement {
3932
3948
 
3933
3949
  // Configure the floater to, this will generate the ID for the bib
3934
3950
  this.floater.configure(this, 'auroDropdown');
3951
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
3935
3952
 
3936
3953
  /**
3937
3954
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -1689,7 +1689,7 @@ class AuroFloatingUI {
1689
1689
  */
1690
1690
  mirrorSize() {
1691
1691
  // mirror the boxsize from bibSizer
1692
- if (this.element.bibSizer) {
1692
+ if (this.element.bibSizer && this.element.matchWidth) {
1693
1693
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1694
1694
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1695
1695
  if (sizerStyle.width !== '0px') {
@@ -1901,13 +1901,13 @@ class AuroFloatingUI {
1901
1901
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1902
1902
  return;
1903
1903
  }
1904
-
1904
+
1905
1905
  // if fullscreen bib is in fullscreen mode, do not close
1906
1906
  if (this.element.bib.hasAttribute('isfullscreen')) {
1907
1907
  return;
1908
1908
  }
1909
1909
 
1910
- this.hideBib();
1910
+ this.hideBib("keydown");
1911
1911
  }
1912
1912
 
1913
1913
  setupHideHandlers() {
@@ -1932,7 +1932,7 @@ class AuroFloatingUI {
1932
1932
  document.expandedAuroFormkitDropdown = null;
1933
1933
  document.expandedAuroFloater = this;
1934
1934
  } else {
1935
- this.hideBib();
1935
+ this.hideBib("click");
1936
1936
  }
1937
1937
  }
1938
1938
  };
@@ -1945,7 +1945,7 @@ class AuroFloatingUI {
1945
1945
  // if something else is open, let it handle itself
1946
1946
  return;
1947
1947
  }
1948
- this.hideBib();
1948
+ this.hideBib("keydown");
1949
1949
  }
1950
1950
  };
1951
1951
 
@@ -2028,7 +2028,11 @@ class AuroFloatingUI {
2028
2028
  }
2029
2029
  }
2030
2030
 
2031
- hideBib() {
2031
+ /**
2032
+ * Hides the floating UI element.
2033
+ * @param {String} eventType - The event type that triggered the hiding action.
2034
+ */
2035
+ hideBib(eventType = "unknown") {
2032
2036
  if (!this.element.disabled && !this.element.noToggle) {
2033
2037
  this.lockScroll(false);
2034
2038
  this.element.triggerChevron?.removeAttribute('data-expanded');
@@ -2039,7 +2043,7 @@ class AuroFloatingUI {
2039
2043
  if (this.showing) {
2040
2044
  this.cleanupHideHandlers();
2041
2045
  this.showing = false;
2042
- this.dispatchEventDropdownToggle();
2046
+ this.dispatchEventDropdownToggle(eventType);
2043
2047
  }
2044
2048
  }
2045
2049
  document.expandedAuroFloater = null;
@@ -2048,11 +2052,13 @@ class AuroFloatingUI {
2048
2052
  /**
2049
2053
  * @private
2050
2054
  * @returns {void} Dispatches event with an object showing the state of the dropdown.
2055
+ * @param {String} eventType - The event type that triggered the toggle action.
2051
2056
  */
2052
- dispatchEventDropdownToggle() {
2057
+ dispatchEventDropdownToggle(eventType) {
2053
2058
  const event = new CustomEvent(this.eventPrefix ? `${this.eventPrefix}-toggled` : 'toggled', {
2054
2059
  detail: {
2055
2060
  expanded: this.showing,
2061
+ eventType: eventType || "unknown",
2056
2062
  },
2057
2063
  composed: true
2058
2064
  });
@@ -2062,7 +2068,7 @@ class AuroFloatingUI {
2062
2068
 
2063
2069
  handleClick() {
2064
2070
  if (this.element.isPopoverVisible) {
2065
- this.hideBib();
2071
+ this.hideBib("click");
2066
2072
  } else {
2067
2073
  this.showBib();
2068
2074
  }
@@ -2089,7 +2095,7 @@ class AuroFloatingUI {
2089
2095
 
2090
2096
  event.preventDefault();
2091
2097
  this.handleClick();
2092
- }
2098
+ }
2093
2099
  break;
2094
2100
  case 'mouseenter':
2095
2101
  if (this.element.hoverToggle) {
@@ -2098,7 +2104,7 @@ class AuroFloatingUI {
2098
2104
  break;
2099
2105
  case 'mouseleave':
2100
2106
  if (this.element.hoverToggle) {
2101
- this.hideBib();
2107
+ this.hideBib("mouseleave");
2102
2108
  }
2103
2109
  break;
2104
2110
  case 'focus':
@@ -3486,6 +3492,9 @@ class AuroDropdown extends AuroElement {
3486
3492
 
3487
3493
  this.parentBorder = false;
3488
3494
 
3495
+ /** @private */
3496
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3497
+
3489
3498
  this.privateDefaults();
3490
3499
  }
3491
3500
 
@@ -3919,12 +3928,19 @@ class AuroDropdown extends AuroElement {
3919
3928
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3920
3929
  this.handleTriggerContentSlotChange();
3921
3930
  }
3931
+ }
3922
3932
 
3923
- if (changedProperties.has('isPopoverVisible')) {
3924
- this.updateFocusTrap();
3925
- if (!this.isPopoverVisible && this.hasFocus) {
3926
- this.trigger.focus();
3927
- }
3933
+ /**
3934
+ * Handles the custom event `auroDropdown-toggled` to update the visibility of the dropdown bib.
3935
+ * @private
3936
+ * @param {CustomEvent} event - The custom event that contains the dropdown toggle information.
3937
+ */
3938
+ handleDropdownToggle(event) {
3939
+ this.updateFocusTrap();
3940
+ this.isPopoverVisible = event.detail.expanded;
3941
+ const eventType = event.detail.eventType || "unknown";
3942
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
3943
+ this.trigger.focus();
3928
3944
  }
3929
3945
  }
3930
3946
 
@@ -3932,6 +3948,7 @@ class AuroDropdown extends AuroElement {
3932
3948
 
3933
3949
  // Configure the floater to, this will generate the ID for the bib
3934
3950
  this.floater.configure(this, 'auroDropdown');
3951
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
3935
3952
 
3936
3953
  /**
3937
3954
  * @description Let subscribers know that the dropdown ID ha been generated and added.