TylerBarnes / gatsby-plugin-transition-link

A link component for page transitions in gatsby
537 stars 70 forks source link

Inconsistent scroll position while navigating to IDs #190

Closed yongkyali closed 4 years ago

yongkyali commented 4 years ago

I have just started to use TL and it's awesome. I actually am going to use AniLink on my latest website. But I come to one problem, which I can't navigate to ID attributes anymore using AniLink or TransitionLink.

Here's one example: <AniLink to="/product#product_1" paintDrip /> which should navigate to <div id="product_1" />, but it's not working.

Thanks!

yongkyali commented 4 years ago

I just found out that my top position of attribute caught in hash passed to function/onEnter() to be negative.

DOMRect :
bottom: -1235.800048828125
height: 325.5999755859375
left: 74.85000610351562
right: 1004.8500061035156
top: -1561.4000244140625
width: 930
x: 74.85000610351562
y: -1561.4000244140625

I cloned this repo, do yarn install && gatsby develop, do logging, and found out the example project is working well (the top's value is positive and just right). I dunno what's wrong in my project. Has anyone ever facing this kind of problem?

yongkyali commented 4 years ago

published in gatsby-plugin-transition-link@1.18.3