-
Notifications
You must be signed in to change notification settings - Fork 14
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 mismatch with ToC #516
base: main
Are you sure you want to change the base?
Conversation
Your demo site is ready! 🚀 Visit it here: https://ramp4-pcar4.github.io/story-ramp/toc-mismatch/#/en/00000000-0000-0000-0000-000000000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 1 files reviewed, 1 unresolved discussion (waiting on @IshavSohal)
src/router/index.ts
line 28 at r1 (raw file):
el: decodeURIComponent(to.hash), behavior: 'smooth', top: window.innerHeight / 6
This seems to fix the issue, but I'm wondering if there's maybe a way to fix this problem by adjusting the activeChapterIndex
logic instead? There are some fancy calculations being done here, which is what we use to determine which chapter is currently active (and therefore which ToC entry is highlighted). Maybe playing around with this logic may also fix the problem?
EDIT: The scrollama component in the same file also supports a threshold
property that may be useful to play around with as well.
The previous top
value calculation was just added about a month ago to fix an issue where clicking on a ToC entry wouldn't take the user to the top of a slide, which this new calculation re-introduces.
85e3b60
to
15222a6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @RyanCoulsonCA)
src/router/index.ts
line 28 at r1 (raw file):
Previously, RyanCoulsonCA (Ryan Coulson) wrote…
This seems to fix the issue, but I'm wondering if there's maybe a way to fix this problem by adjusting the
activeChapterIndex
logic instead? There are some fancy calculations being done here, which is what we use to determine which chapter is currently active (and therefore which ToC entry is highlighted). Maybe playing around with this logic may also fix the problem?The previous
top
value calculation was just added about a month ago to fix an issue where clicking on a ToC entry wouldn't take the user to the top of a slide, which this new calculation re-introduces.
Donethanks. I decided to set the offset
property (which has default value of 0.5) to 0.1. This causes a slide change to be detected when the top border of a slide crosses the 10% mark of the screen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing against both the horizontal ToC (https://ramp4-pcar4.github.io/story-ramp/toc-mismatch/#/en/00000000-0000-0000-0000-000000000000) and vertical ToC (https://ramp4-pcar4.github.io/story-ramp/toc-mismatch/#/fr/00000000-0000-0000-0000-000000000000), clicking on a ToC item scrolls to the correct section but highlights the wrong item.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @RyanCoulsonCA)
Related Item(s)
ramp4-pcar4/storylines-editor#437
Changes
Testing
Steps:
This change is