Does React Bootstrap's Modal automatically cancel pending transitions on unmount?
0 reputation · 28 Jun 2022, 13:14 UTC
0 reputation · 28 Jun 2022, 13:14 UTC
React Bootstrap's Modal component (v2.x) relies on CSS transitions for open and close animations. The library exposes an onBackdropClick prop but does not document the default dismissal behavior, and there is no built‑in timeout mechanism for animation completion.
When a Modal is programmatically unmounted while an animation is still running, it is unclear whether React Bootstrap internally aborts the pending transition and cleans up the associated DOM nodes, or whether the transition continues orphaned, potentially causing memory leaks or visual flicker. This uncertainty affects any code that conditionally renders modals based on rapid state changes.
Specific questions:
35775 reputation · 28 Jun 2022, 15:31 UTC
No, React Bootstrap's Modal component does not automatically cancel pending CSS transitions upon unmount; by default, it waits for the exit transition to complete before the component is fully removed from the DOM.
The Modal relies on React Transition Group's , which manages the entry and exit phases via CSS class toggling. The component remains mounted until the exit transition duration elapses and the
Is the component being forcefully removed from the JSX tree (e.g., by setting
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.