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

🐛 Nightmare Bug – Scroll Event Listening Offset Calculation Bug #2230

Merged
merged 6 commits into from
Sep 20, 2024

Conversation

isaaclombardssw
Copy link
Contributor

@isaaclombardssw isaaclombardssw commented Sep 19, 2024

Related to and closes #2211.

To test the fix, please go the vercel, then Docs | Introduction to TinaCMS.

Previously...

  • Page scroll position versus headings calculated in pixels from the DOM with element.offsetTop and window.scrollY, compared to some magic number.
  • These two variables in some cases diverging min/max values depending on screen sizes, so the comparison stops being an accurate position of location on the page.

Updated impl...

  • Scroll position and headings in comparison are both totally relative (scroll pos vs maximum scroll pos, and heading pos vs maximum content height).
  • No magic numbers.
### General Contributing:

All New Content Submissions: (To be confirmed by reviewer)

  • Title is short & specific
  • Headers are logically ordered & consistent
  • Purpose of document is explained in the first paragraph
  • Procedures are tested and work
  • Any technical concepts are explained or linked to
  • Document follows structure from templates
  • All links work
  • The spelling and grammar checker has been run
  • Graphics and images are clear and useful
  • Any prerequisites and next steps are defined.

Copy link

vercel bot commented Sep 19, 2024

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

Name Status Preview Comments Updated (UTC)
tina-io ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 20, 2024 1:38am

@isaaclombardssw isaaclombardssw changed the title Scroll event listening offset trap 🐛 Nightmare Material – Scroll Event Listening Offset Calculation Bug Sep 19, 2024
@isaaclombardssw isaaclombardssw changed the title 🐛 Nightmare Material – Scroll Event Listening Offset Calculation Bug 🐛 Nightmare Bug – Scroll Event Listening Offset Calculation Bug Sep 19, 2024
@isaaclombardssw isaaclombardssw marked this pull request as ready for review September 19, 2024 07:34
@isaaclombardssw isaaclombardssw requested a review from a team as a code owner September 19, 2024 07:34
Copy link
Member

@bradystroud bradystroud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 quick suggestions

pages/api/feedback.ts Outdated Show resolved Hide resolved
pages/api/graphql.ts Outdated Show resolved Hide resolved
utils/toc_helpers.ts Outdated Show resolved Hide resolved
@isaaclombardssw isaaclombardssw merged commit cad4060 into main Sep 20, 2024
4 checks passed
@isaaclombardssw isaaclombardssw deleted the scroll-event-listening-offset-trap branch September 20, 2024 01:41
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.

🐛 Introduction to TinaCMS - cannot reach last section
2 participants