Fix scrolling bug in Chrome 102+#64
Merged
tkadlec merged 2 commits intocatchpoint:mainfrom Jun 27, 2022
Merged
Conversation
👷 Deploy request for webpagetest-documentation accepted.
|
Contributor
Author
Contributor
Author
|
🤷♂️ Not sure but this might be related? https://bugs.chromium.org/p/chromium/issues/detail?id=1318615 Seeing the same issue in Chrome Canary too. |
Contributor
|
Really nice catch, @tannerhodges! This issue has been a bit of a ghost (I ran into it, but no one else on the team and no one has ever reported it, so I never made it a priority to sort out what was up). Thanks for doing this! |
Contributor
Author
|
🙌 Awesome, anytime! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


😬 Hey y'all, I ran into an issue where I'm unable to read the Getting Started page: https://docs.webpagetest.org/getting-started/
Problem: scrollIntoView() scrolls the whole document
When I try to scroll down, the IntersectionObserver in
in-page-nav.jsjumps me back to the top of the page:2022-06-25.WebPageTest.documentation.scroll.jank.mp4
Solution: Replace scrollIntoView() with scrollTo()
Initially, I quick-fixed the issue by just removing the
scrollIntoView()call.But based on #25, since the original intent was for this to scroll to each link as its heading comes into view, I've replaced
scrollIntoView()(which seems to scroll the whole document) withscrollTo()(which only scrolls the TOC element).2022-06-25.Fix.WebPageTest.scroll.jank.by.replacing.scrollIntoView.with.scrollTo.mp4
I also tested on pages with long TOCs (like Scripting) and short TOCs (like Accounts) or no TOC (like Custom Metrics Examples).
To keep the PR as simple as possible, I used
.closest('.toc')instead of a separatetocvariable.🙏 Hopefully this helps.
Let me know if there are any other changes y'all recommend for this update.