-
Notifications
You must be signed in to change notification settings - Fork 71
Scroll position #76
Comments
THanks for the compliment! I've been thinking of adding a new feature which allows you to control the scrolling yourself. I'm thinking something like: <Link to={...} exit={...} entry={...} preventScrollJump>Go home</Link> What do you think? Alternatively I've been thinking of adding css to lock the scroll on the body element and then add overflow auto to the individual page elements but I think this may break some other packages so I'm not too sure on what the best way forward with this one is. |
Hmm, actually maybe this would be better as a plugin setting in |
@TylerBarnes any update on this? Accepting PRs to this/#71? |
@dlimx no updates yet. I'm definitely accepting PR's! |
@TylerBarnes I'm seeing this jump to the top on exit even with the AniLink fade links shown on the example site: https://gatsby-plugin-transition-link.netlify.com/ (try scrolling down a little and then clicking the "Fade to page 2" link. It seems the holdPosition CSS passed to GSAP is not preventing the scroll jump. I'm having the same issue in one of my projects and the only solution is to set the exit duration to 0.
|
@blimpmason I think I'm going to have to put out a v2 with breaking changes and rethink how the pages are handled. Any help is appreciated! Wether that's PR's or even suggestions / ideas. It's a ton of work maintaining this plugin + my other plugins & working full time. |
I think when I changed the animation strategy from using absolute positioned pages to how it is now, it broke some of these animations as well without me realizing. Does anyone have ideas on how to add tests for animations? |
@TylerBarnes thanks for the response, and your work is really appreciated! I lack the relevant experience to contribute at the moment but I'll ping you if I come up with any ideas as I dig deeper. |
Any updates on this? |
@Jaki117 yep! I've been working on a V2. Nothing to beta test or show yet as I have limited time to work on this project, but I'll let you know when there's something to try |
Hi, I have a AniLink in my Navbar which points to |
Yeah, did a bit of testing. Removed all the AniLink from my shared Navbar and changed them to Link and now my hashed link i.e I believe this is a bug which is being caused by AniLink but I could be wrong about this. Can you please confirm this behavior because I am unsure whether to open a new issue about this or not. For all we know, it could be something wrong with my specific setup. |
Not sure that my case is related to this issue, but it seems like it is. *Edited: Also, it is important to set <TransitionLink
...
exit={{
trigger: ({ node, exit, e }) => {
node.style.position = 'absolute'
node.style.top = '0px'
node.style.left = '0px'
node.style.overflow = 'hidden'
handleClick(e)
},
length: 1,
}}
...
>
{props.children}
</TransitionLink> |
@TylerBarnes any hacky way to completely prevent the window from jumping to the top? I don't need it, since I have 100vh components to navigate to (so it's guaranteed they are fully displayed on the page), but when I go back to the homepage, I need to keep the scroll position. Thank you! (I'm using AniLink) |
@edoardolunardi you could use component shadowing to override the file from your Gatsby site until there's a fix for this. |
@edoardolunardi @TylerBarnes Hey guys, you can prevent window scroll jump to top at the start of the exit transition, adding an appearAfter on entry param. Look this example: <TransitionLink
to={`/${finalLink}`}
partiallyActive={true}
exit={{
length: 1.5,
trigger: ({node, exit, e}) => transitionExitPage(node, exit, e)
}}
entry={{
appearAfter: 0.75,
length: 1.5,
trigger: ({node, entry, exit, e}) => transitionEnterPage(node, entry, exit, e)
}}
>
{children}
</TransitionLink> In this example, window scroll jump to top after 0.75ms. Once you have control over scroll, you could manage easily entry animation on trigger method. |
Looking forward to seeing a simple solution such as |
@acidic9 upgrade to |
@TylerBarnes thank you for your hard work! Is there a way to get this working with the I have a long list of links to my articles. The user can navigate to the content of these links via Sorry to bother you but wrapping my head around the concept is hard as i'm quite new and still learning the bells and whistles of gatsby. |
@Lucasdon If it's not working currently it may need to be wired up in the AniLink components. If you're up to making a PR for it I can guide you through how to get set up. If you're interested, open a new issue with a description of your problem and assign it to yourself and @ me |
I was digging around this issue a lot and I now think it is not really related to your plugin. I have opened a Stack Overflow Question, because I think it is in a different scope. But it would be nice if you could review it and confirm I'm not absolutely wrong. If I'm wrong I'm happy to try a PR. I hope you and everyone else is safe and sound in this strange times... |
When changing pages the scroll position stays the same so the next page doesn't start at the very top |
Any update on this ^ @TylerBarnes A few friends have also had the same issue |
Just bumping this again... |
And again... |
@joebentaylor1995 I'm thinking of deprecating this package :( I don't have the time to work on it even though I really wish I did. I will probably advocate for someone to fork it and continue dev on a new package. If someone does that I will add a link to the top of the Readme and the docs site |
:(
Is there any other solutions to page transitions in Gatsby?
Kind regards,
Joe
… On 17 Sep 2021, at 17:59, Tyler Barnes ***@***.***> wrote:
@joebentaylor1995 I'm thinking of deprecating this package :( I don't have the time to work on it even though I really wish I did. I will probably advocate for someone to fork it and continue dev on a new package. If someone does that I will add a link to the top of the Readme and the docs site
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
I just did a quick google search and it looks like this package https://www.npmjs.com/package/gatsby-plugin-transitions took some inspiration from transition link (they even have a TransitionLink component). I can't vouch for it since I know nothing about it but it might be worth a try. |
Hey @joebentaylor1995, I think today the way to go for page transitions in React in general is using the great Framer Motion: let's just remember that pages in React are components mounting and unmounting, and framer offers a nice api to control this. So I suggest to dive into the (new) Gatsby docs and try framer, it's what I usually use to handle page transitions in React (Gatsby or Next or whatever doesn't matter!) ps: @TylerBarnes thanks for the plugin, I used it in a couple of projects like 2 years ago 🤝 |
I actually use this plugin still with framer motion.
Kind regards,
Joe
… On 17 Sep 2021, at 20:17, Edoardo Lunardi ***@***.***> wrote:
Hey @joebentaylor1995,
Gatsby has evolved since this plugin was released.
I think today the way to go for page transitions in React in general is using the great Framer Motion: let's just remember that pages in React are components mounting and unmounting, and framer offers a nice api to control this.
So I suggest to dive into the (new) Gatsby docs and try framer, it's what I usually use to handle page transitions in React (Gatsby or Next doesn't matter!)
ps: @TylerBarnes thanks for the plugin, I used it in a couple of projects like 2 years ago 🤝
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Is it by design that scroll position is reset to the top whenever a route change happens via this packages link? To me, it looks like it's breaking the flow gained by the animations, the jump to the top is quite extreme.
Also, clicking on a link routing to the URL one is currently on triggers a scroll to the top.
Oh well, I couldn't find anything about this particular question. There's some conversation around scroll position not being updated/used properly, but I think this is different in nature. There might not even be a bug, but behavior which I personally deem unwanted/buggy.
I love this package! It's so easy to get started with and extend to one's needs! Very good job, I'm amazed by the ease of use.
The text was updated successfully, but these errors were encountered: