Does React Bootstrap's Modal automatically cancel pending transitions on unmount?
0 reputation · 28 Jun 2022, 13:14 UTC
Background
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.
Open Question
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:
- Does the Modal component cancel its own transition timers on unmount?
- Is there a documented lifecycle hook or cleanup pattern that guarantees no lingering transition callbacks?
- Which approach—custom timeout handling or relying on internal cleanup—is recommended for reliable dismissal?