Animating expanding and collapsing could be a UX necessity #337
Replies: 7 comments
-
Update - JS controlled animation with easingsI have been working on another solution. This is a drop-in solution, that wraps the The code is commented and tested and working for even very large tree lists. To use it, copy Code and demoWorking code sandbox with demo: https://codesandbox.io/s/xenodochial-meitner-v1950 NOTE: My demo works only if all list items have equal height !! |
Beta Was this translation helpful? Give feedback.
-
@deniskabana This looks amazing! I'm going to dig deeper and see if we can integrate it somehow. I'm thinking either as an HOC example or as part of the dist bundle (in a way that it is tree shakable). If you have ideas, please send them along. |
Beta Was this translation helpful? Give feedback.
-
@mrchief Thank you! I'd be glad to help integrate it with some help from any of the contributors :) I have some pointers and ideas about how we could make it even better were I to change the code that handles tree nodes. |
Beta Was this translation helpful? Give feedback.
-
@deniskabana Please send them along. We can discuss the ideas here or if you want to send any PRs, feel free to do so. As a pointer, when I said tree shakable, I meant something like this:
As long as the core import doesn't bring the whole bundle (core + HoCs), this should be OK; in fact better than OK as we're now enhancing the developer's experience without imposing any extra bundling cost. Does that make sense? |
Beta Was this translation helpful? Give feedback.
-
@mrchief Sure thing! First of all let's review all issues with my current solutions: Issues
Other propositions
|
Beta Was this translation helpful? Give feedback.
-
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Beta Was this translation helpful? Give feedback.
-
Hey @deniskabana, not sure what happened here. Were you expecting something from me? |
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
For
react-dropdown-tree-select
everything is rendered as a single unordered list with padding added onnode.style
(for tree list with expanded children). I suppose this is due to CSS hiding when filtering (which is quite clever and fast) but kills hierarchy (elements are not wrapped). Makes it very very difficult to implement sliding animation for reveal (close animation is not as necessary for our use-case and from a UX standpoint could be omitted or just very quick).TL;DR: Expanding children in a tree results in mounting and dismounting list items to the top-level row. Very hard to add animation to this type of usage.
Sandbox of the setup in GIF:
https://codesandbox.io/s/cool-noether-p3f41?fontsize=14&hidenavigation=1&theme=dark
Describe the solution you'd like
<li class="node tree"><div class="list-item-container">...</div></li>
and wrap nested children in aul > li
structure as well. I feel like I am missing something here, though.delayUnmount?: number = 0
) and create new callbacks ->nestedChildrenDidMount(nestedChildren: TreeNode[] | string[])
andnestedChildrenWillUnmount(timeUntilUnmount: number)
. Doesn't solve revealing animations however.Describe alternatives you've considered
Right now, to achieve the desired result, I am using a hack - linear transition and style/className manipulation. Easing could have severe impact on performance and I don't think adding custom JS easing for multiple elements is worth the added overhead to the code. See https://codesandbox.io/s/cool-noether-p3f41?fontsize=14&hidenavigation=1&theme=dark for code.
Additional context
I'd be happy for any suggestions or ideas in this matter.
Beta Was this translation helpful? Give feedback.
All reactions