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

ScrollView issues #3

Open
JayPanoz opened this issue Mar 7, 2019 · 0 comments
Open

ScrollView issues #3

JayPanoz opened this issue Mar 7, 2019 · 0 comments

Comments

@JayPanoz
Copy link
Contributor

JayPanoz commented Mar 7, 2019

Just as a heads-up if you’re using the current master – or the jbks-shared branch…

There’s quite a significant amount of issues with the scroll view, that took an awful amount of time to debug because it’s not obvious – and there’s an off-by-one error courtesy of Safari iOS on top of that.

So the list of issues:

  • chapters’ navigation bar (previous/next) not displayed when you reach the bottom of the current chapter;
  • double-scroll happening in Chrome/Firefox i.e. you scroll and there’s an almost unnoticeable pause in your scrolling → that’s the iframe kinda behaving as a parasite, because its explicit height is not what those browsers expect;
  • in addition, progression is not updated correctly in those browsers;
  • finally onscroll event is not debounced (clear/setTimeout), so as resize, it will fire frantically – after debouncing it, I could see a significant performance boost in some browsers actually.

So to put it simply…

Don’t trust document.body when it comes to scroll. I learn the hard way scrolling is a clusterfuck, and document.body is supposed to be quirks mode.

In other words…

document.scrollingElement || document.body

is the way to go.

This scrollingElement will either be document.documentElement (compat mode) or document.body (quirks mode). And that pretty much solve all the issues, including in the iframe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant