Skip to content

Commit f739749

Browse files
author
Helen Le
committed
chore(dialog): revert animation transition changes
1 parent 7914548 commit f739749

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

packages/dialog/src/DialogBase.ts

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ import '@spectrum-web-components/underlay/sp-underlay.js';
2424
import '@spectrum-web-components/button/sp-button.js';
2525

2626
// Leveraged in build systems that use aliasing to prevent multiple registrations: https://github.com/adobe/spectrum-web-components/pull/3225
27-
import '@spectrum-web-components/dialog/sp-dialog.js';
27+
// Get around lint error by importing locally for now. Not required for actual change.
28+
import '../sp-dialog.js';
2829
import modalWrapperStyles from '@spectrum-web-components/modal/src/modal-wrapper.css.js';
2930
import modalStyles from '@spectrum-web-components/modal/src/modal.css.js';
3031
import { Dialog } from './Dialog.js';
@@ -155,41 +156,18 @@ export class DialogBase extends FocusVisiblePolyfillMixin(SpectrumElement) {
155156
this.handleTransitionEvent(event);
156157
}
157158

158-
private get hasTransitionDuration(): boolean {
159-
const modal = this.shadowRoot.querySelector('.modal') as HTMLElement;
160-
161-
const modalTransitionDurations =
162-
window.getComputedStyle(modal).transitionDuration;
163-
for (const duration of modalTransitionDurations.split(','))
164-
if (parseFloat(duration) > 0) return true;
165-
166-
const underlay = this.shadowRoot.querySelector(
167-
'sp-underlay'
168-
) as HTMLElement;
169-
170-
if (underlay) {
171-
const underlayTransitionDurations =
172-
window.getComputedStyle(underlay).transitionDuration;
173-
for (const duration of underlayTransitionDurations.split(','))
174-
if (parseFloat(duration) > 0) return true;
175-
}
176-
177-
return false;
178-
}
179-
180159
protected override update(changes: PropertyValues<this>): void {
181160
if (changes.has('open') && changes.get('open') !== undefined) {
182-
const hasTransitionDuration = this.hasTransitionDuration;
183161
this.animating = true;
184162
this.transitionPromise = new Promise((res) => {
185163
this.resolveTransitionPromise = () => {
186164
this.animating = false;
187-
if (!this.open && hasTransitionDuration)
188-
this.dispatchClosed();
189165
res();
190166
};
191167
});
192-
if (!this.open && !hasTransitionDuration) this.dispatchClosed();
168+
if (!this.open) {
169+
this.dispatchClosed();
170+
}
193171
}
194172
super.update(changes);
195173
}

0 commit comments

Comments
 (0)