Open drmeloy opened 4 years ago
The width of the page is a contributing factor to this bug, but I haven't been able to figure out specific points where the links are broken or why the page widths are impacting scrolling all the way to make a section active. Sometimes the section will never become active by clicking the link, only by beginning to manually scroll.
I'm wondering if this has to do with interactions between paddings, margins, and Link offset. My page is several 100vh sections, so I would expect scroll to go all the way, but offset has been necessary (which in and of itself seems like a bug), and since margins etc change at break points maybe this is impacting offset's ability to do its job?
Did you find a solution to this? I'm running into the same problem.
I solved this by letting react-waypoint do the "set active" handling instead. So I removed spy
and onSetActive
from my <Link>
elements and wrapped each targeted element with <Waypoint>
. That way you get more control of when the target element is activated, and you can offset the triggers freely with using waypoints, while still keeping any scroll offset set in the <Link>
element.
If a Link in a nav bar is clicked, the page will scroll to the section, but the section will not become active until the Link is clicked a second time. This only happens on some sections at certain page widths. Using offset does not fix the issue.