react-arborist
react-arborist copied to clipboard
React Aborist ScrollTo bug with deep nested nodes
Example App https://stackblitz.com/~/github.com/justin-elias/remix-run-remix-pavg6k (I just noticed that the preview doesn't always open on init. You may have to Ctrl-Click the local host url in the terminal)
When I pass in an id to the selection prop, if the node is deeply nested and pushed outside the view of the tree container, the scrollTo function doesn't bring the node into view.
Expected: The tree will be expanded and the selected node scrolled into view vertically and horizontally
Bug: Notice that the tree will scroll vertically to the node, but does not scroll horizontally to bring the node into view
This looks like it might be an issue with react-window, and not react-arborist specifically. The scroll applies to the row index, and doesn't take into account whether the descendants of the row are visible.
A possible solution is to call scrollIntoView on the node component that should be visible in a useEffect