Actions.router.set doesn't send new page to top

I have links at the bottom of my posts to similar posts that the reader may be interested in. When they click on those links, the router sends them to the new page, but the scroll position stays at the bottom even after rendering the new post. The expected behavior is for the top of the new post to be displayed.

I’m using:

>     `const onClick = (event) => {
>         event.preventDefault();
>         actions.router.set(post.link);
>     }`

for my click events as outlined in the tiny-router documentation

Is this intentional behavior for actions.router.set? Is one of my dependencies causing unexpected behavior?

Hi @hammondjp11 ,

Can you please provide a repo or code-sandbox with your code? This is especially helpful to find solutions to technical issues with specific code

I think if you remove the line event.preventDefault(); from the event handler the behaviour should be as you expect

Besides this, you don’t need to create an onClick event to navigate through links. You can use the <Link> component that internally will take care of using the Frontity router package internally

Hope this helps