Skip to content

Conversation

unasuke
Copy link
Contributor

@unasuke unasuke commented Oct 12, 2024

Motivation / Background

step to reproduce

  1. Access https://edgeguides.rubyonrails.org
  2. Visit "Upgrading Ruby on Rails" or any else page by clicking guides index
  3. "Chapters" scrolls end of list
Ruby.on.Rails.Guides.-.Google.Chrome.2024-10-13.04-14-09.mp4

When visiting a guide page by turbo, the navHighlight function fires the scrollIntoView API.
Then, the chapter scrolls to the end of the chapter list by the updateHighlight function because IntersectionObserver's time origin is the first page loaded.

Detail

To fix this, add "is the page navigated by directly" to the condition of the call updateHighlight function.

Additional information

Checklist

Before submitting the PR make sure the following are checked:

  • This Pull Request is related to one change. Unrelated changes should be opened in separate PRs.
  • Commit message has a detailed description of what changed and why. If this PR fixes a related issue include it in the commit message. Ex: [Fix #issue-number]
  • Tests are added or updated if you fix a bug or add a feature.
  • CHANGELOG files are updated for the changed libraries if there is a behavior change or additional feature. Minor bug fixes and documentation changes should not be included.

When visiting a guide page by turbo, the navHighlight function fires
the scrollIntoView API.
Then, the chapter scrolls to the end of the chapter list by the
updateHighlight function because IntersectionObserver's time origin
is the first page loaded.

To fix this, add "is the page navigated by directly" to the condition
of the call updateHighlight function.
@rails-bot rails-bot bot added the docs label Oct 12, 2024
@kamipo kamipo merged commit f942221 into rails:main Oct 13, 2024
2 checks passed
@unasuke unasuke deleted the fix-unintended-scrolling-in-chapters branch October 13, 2024 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants