When a component disappears (modal close, dropdown hide), it should animate out before being removed from DOM. Sudden disappearance is jarring. You need to delay removal until the animation finishes.
animateExit(element, options) applies a CSS class that triggers the exit animation, waits for the transition/animation to
finish (or a timeout), and then resolves a Promise. You can then safely remove the element from the DOM.
Dialog, Dropdown, Popover, Tooltip, Toast, Modal, Alert