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.
-
Transition
component is very powerful. It currently supports 2 "modes" controlled byunmount
prop. Whenunmount
is true theTransition
node is (eventually) removed from the DOM after theshow
becomes false. Whenunmount
is false theTransition
node (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
Transition
job.It could be made possible by adding a 3rd
Transition
mode 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
!block
toleaveFrom
which basically cancels thedisplay: none
added byTransition
:Not sure about potential pitfalls of this, though 🤔
Beta Was this translation helpful? Give feedback.
All reactions