Transition variant with visibility:hidden instead of display:none #2676
ivan-kleshnin
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
|
Does it still work on 2.1? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Transitioncomponent is very powerful. It currently supports 2 "modes" controlled byunmountprop. Whenunmountis true theTransitionnode is (eventually) removed from the DOM after theshowbecomes false. Whenunmountis false theTransitionnode (eventually) getsdisplay:none. That's my understand – pls. correct if I'm wrong...I'm working on an alert stack, something like https://react-hot-toast.com/ where alert elements should keep their heights after they become invisible. For some time – to prevent new alerts added below from jumping to above positions. Hidden DOM elements are "garbage collected" separately, not a
Transitionjob.It could be made possible by adding a 3rd
Transitionmode withvisibility: hidden. Another example from the same project is harder to describe, but it also requires a hidden element to preserve the original height.The workaround I've found is to add
!blocktoleaveFromwhich basically cancels thedisplay: noneadded byTransition:Not sure about potential pitfalls of this, though 🤔
Beta Was this translation helpful? Give feedback.
All reactions