@brightspace-ui/core 2.128.4 → 2.128.5

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.
@@ -119,17 +119,17 @@ class ExpandCollapseContent extends LitElement {
119
119
  ));
120
120
  }
121
121
  if (reduceMotion || firstUpdate) {
122
- this._state = states.EXPANDED;
123
- this._height = 'auto';
124
- this._eventPromiseResolve();
122
+ this._setExpanded();
125
123
  } else {
126
124
  this._state = states.PREEXPANDING;
127
125
  await this.updateComplete;
128
126
  await new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r)));
129
127
  if (this._state === states.PREEXPANDING) {
130
128
  this._state = states.EXPANDING;
131
- const content = this.shadowRoot && this.shadowRoot.querySelector('.d2l-expand-collapse-content-inner');
132
- if (content) this._height = `${content.scrollHeight}px`;
129
+ const content = this.shadowRoot?.querySelector('.d2l-expand-collapse-content-inner');
130
+ const contentHeight = content?.scrollHeight;
131
+ if (contentHeight) this._height = `${contentHeight}px`;
132
+ if (contentHeight === 0) this._setExpanded();
133
133
  }
134
134
  }
135
135
  } else {
@@ -159,14 +159,17 @@ class ExpandCollapseContent extends LitElement {
159
159
 
160
160
  _onTransitionEnd() {
161
161
  if (this._state === states.EXPANDING) {
162
- this._state = states.EXPANDED;
163
- this._height = 'auto';
164
- this._eventPromiseResolve();
162
+ this._setExpanded();
165
163
  } else if (this._state === states.COLLAPSING) {
166
164
  this._state = states.COLLAPSED;
167
165
  this._eventPromiseResolve();
168
166
  }
169
167
  }
170
168
 
169
+ _setExpanded() {
170
+ this._state = states.EXPANDED;
171
+ this._height = 'auto';
172
+ this._eventPromiseResolve();
173
+ }
171
174
  }
172
175
  customElements.define('d2l-expand-collapse-content', ExpandCollapseContent);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.128.4",
3
+ "version": "2.128.5",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",