Skip to content
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

Infinite Loop Between Scroll and Redraw on Browser Zoom #238

Closed
arthur-cheung opened this issue Jan 2, 2020 · 2 comments · Fixed by #240
Closed

Infinite Loop Between Scroll and Redraw on Browser Zoom #238

arthur-cheung opened this issue Jan 2, 2020 · 2 comments · Fixed by #240
Labels
bug Something isn't working released

Comments

@arthur-cheung
Copy link
Contributor

arthur-cheung commented Jan 2, 2020

When adjusting browser zoom, it appears _redraw is triggered which calls _updateScrollTop in Core.js. This in turn triggers event listeners on scroll which call onMouseScrollSide, which in turn calls _redraw again, causing an infinite loop of scroll.

The symptoms are the timeline will slowly scroll to the top. When it reaches the top it then "jitters".

infinite-scroll

From what I can follow in the code, I would have expected this to happen all the time. But I can only reproduce it under certain browser zooms. In the case of the example I created in codesandbox, I can only produce it at 75% zoom. So I'm obviously missing some understanding here of how the code works.

Nevertheless, I think this can be fixed easily if a flag is just set to true when _updateScrollTop is called. Then in onMouseScrollSide, if this flag is true, set it to false and abort. I am happy to take this change on if this is deemed okay.

I would also like to fill in my gaps in understanding why this only occurs on certain zooms, if anyone knows.

Example created in codesandbox here.

EDIT - Additional notes:

  • I have only observed this in Chrome.
  • As the problem is with the scroll itself, it is important that maxHeight is set in the options to the timeline.
arthur-cheung pushed a commit to arthur-cheung/vis-timeline that referenced this issue Jan 3, 2020
@yotamberk yotamberk added the bug Something isn't working label Jan 5, 2020
arthur-cheung added a commit to arthur-cheung/vis-timeline that referenced this issue Jan 6, 2020
yotamberk added a commit to arthur-cheung/vis-timeline that referenced this issue Jan 18, 2020
@yotamberk
Copy link
Member

Very interesting. Not sure why this happens, especially only in Chrome.

yotamberk added a commit that referenced this issue Jan 18, 2020
…redraw (#238) (#240)

* Added flag to programatic scrolling to avoid infinite scroll during redraw. (#238)

* Update Core.js

Co-authored-by: Yotam Berkowitz <[email protected]>
@vis-bot
Copy link
Collaborator

vis-bot commented Jan 18, 2020

🎉 This issue has been resolved in version 6.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sennahoi added a commit to Sennahoi/vis-timeline that referenced this issue Jan 13, 2021
yotamberk added a commit that referenced this issue Jan 15, 2021
* Update Core.js

Fixed flickering when scrolling at the end of the timeline, fixes #422

* Alternative fix for #238

Co-authored-by: Yotam Berkowitz <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
3 participants