-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move headers to scroll element, making scrolling smooth and stay in sync #695
base: master
Are you sure you want to change the base?
Conversation
Rebased against branch with lint:fix pre run msand#1 |
Hey @msand , great work! I am still to do a thorough review of this PR, but I looked at this really quickly. I really like the approach you took to solve the issue. I've tried it before but had no luck making it work. |
@Ilaiwi Thanks! The sticky prop is only for the header, such that it stays on top, alternatively scrolls away when moving vertically. The old css method doesn't work with the changes to the DOM, so I decided to add support for that using a prop instead. The position: sticky on the sidebars, is because using position: fixed moves it to the wrong place, unless we set a transform, perspective, or filter on the ancestor we want to position it relative to, sticky does what we want by default, by sticking to its nearest ancestor that has a "scrolling mechanism" / containing block. Different header heights could be handled the same way as resizing is handled now, at least the height of the header changes much less often than the scroll offset, probably causes less flickering/visual changes than the previous unsynchronised scrolling. At least personally, where I use it now, I know the needed height for the header depending on various settings, and just pass the headerHeight to the timeline as a prop. |
I've left the handleHeaderRef prop intact, so that can probably be used with a very similar pattern to this: react-calendar-timeline/src/lib/Timeline.js Lines 453 to 494 in f7ffd40
|
Thanks a lot @msand . This fixed my problem with the scrolling on osx Chrome. Would be nice if this could be merged into the master. Thanks for a reply in advance. |
Any chances that this fix will appear in build soon? |
Hi! Any news about when it possibly can be merged into master? |
Scrolling in the current version causes the header to flicker, because it's not inside the scroll element, and the scroll events processed by js are much fewer than actual events. This pr moves the rendering inside the scroll element. Thus making all the content stay in sync and causes much less nausea when using it.
Overview of PR
Changes are relatively minor, but running the lint:fix command caused quite a bit of noise.
Perhaps a separate pr which runs the lint fix first would make it clearer what has changed.
Don't forget to update the CHANGELOG.md file with any changes that are in this PR