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

Fix auto-scroll undershooting correction location on initial page load #2237

Closed
wants to merge 3 commits into from

Conversation

nrankin18
Copy link

@nrankin18 nrankin18 commented Sep 24, 2023

Summary

Bug: Navigating to an anchor link on docs with images causes the initial auto-scroll to "undershoot" the correct location. This is because the scroll location is calculated prior to the images loading, so the image heights aren't accounted for in the location calculation.

Fix: Replace Tweezer animation with scrollIntoView which adjusts for image heights.

Additional Bug: Auto-scroll on an initial page load does not scroll the appropriate sidebar element into view. This is because the #highlight function was blocked while the Tweezer animation was running.

Fix: Delay the #highlight function from running until scrollIntoView has finished.

Related issue, if any:

#351
#559

What kind of change does this PR introduce?

Bugfix

For any code change,

  • Related documentation has been updated, if needed
  • Related tests have been added or updated, if needed

Does this PR introduce a breaking change?

No

Tested in the following browsers:

  • Chrome
  • Firefox
  • Safari
  • Edge

@vercel
Copy link

vercel bot commented Sep 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docsify-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 24, 2023 7:40pm

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

Successfully merging this pull request may close these issues.

1 participant