Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback timeout to reset modalClosing flag in ModalManager #3929

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion framework/core/js/src/common/components/ModalManager.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,21 @@ export default class ModalManager extends Component<IModalManagerAttrs> {
closedCallback();
};

this.activeDialogElement.addEventListener('transitionend', afterModalClosedCallback, { once: true });
// Set a fallback timeout to ensure the modalClosing flag is reset
// If not reset, there could be another modal that cannot be closed anymore
// because the modalClosing flag is still set to true
const timeoutId = setTimeout(() => {
this.modalClosing = false;
}, 1000);

this.activeDialogElement.addEventListener(
'transitionend',
() => {
clearTimeout(timeoutId); // Clear the timeout if transition ends
afterModalClosedCallback();
},
{ once: true }
);

this.activeDialogElement.classList.remove('in');
this.activeDialogElement.classList.add('out');
Expand Down
Loading