Move headers to scroll element, making scrolling smooth and stay in sync#695
Move headers to scroll element, making scrolling smooth and stay in sync#695msand wants to merge 2 commits intonamespace-ee:mainfrom
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? |
|
This PR has been marked as outdated. Here's why: The entire codebase has been rewritten for v0.30.0-beta.5, and every file this PR touches has been replaced:
The header-flicker issue this PR addressed may need to be re-evaluated against the current architecture, but this diff cannot be applied to the current TypeScript source. Thank you for the contribution! The idea/fix was appreciated even if the codebase has moved on. |
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