Skip to content

Commit

Permalink
Add fallback timeout to reset modalClosing flag in
Browse files Browse the repository at this point in the history
ModalManager component.
  • Loading branch information
iPurpl3x committed Nov 16, 2023
1 parent f07336e commit 523b3fd
Showing 1 changed file with 15 additions and 1 deletion.
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

0 comments on commit 523b3fd

Please sign in to comment.