Sync new node scroll positions with existing ones when initially added
Problem: Currently if you add a new ScrollSyncNode to an existing group, there is no mechanism to sync the scroll position for the newly added element until after the user scrolls any of the nodes manually.
Proposed solution: When a new node is registered, if there is an existing node in the group, trigger a scroll sync between the existing node and the new one. This causes the new node to be synced as if the user moved the scrollbar.
The choice of the first node to sync against is arbitrary, as all existing nodes should be synced and the result should be the same no matter which node is synced against. (At least to my knowledge, only caveat is if using non-proportional scrolls with different sizes which cannot be handled consistently in any case)
There is an example showing the behaviour in the InitialSyncExample component.
@AhmadMHawwash are you still maintaining this package? 🙂
If anyone has the same issue I published this fix on https://www.npmjs.com/package/@roligheten/scroll-sync-react