Skip to content
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

Bug: vertical scroll retained when navigating between pages #460

Open
calumbell opened this issue Feb 19, 2024 · 2 comments
Open

Bug: vertical scroll retained when navigating between pages #460

calumbell opened this issue Feb 19, 2024 · 2 comments

Comments

@calumbell
Copy link
Contributor

Currently, if you navigate from one page to another page on site the vertical scroll position is remembered. So when you are navigating between two pages that both overflow the browser window, you will not see the top of the new page, but somewhere further down the page.

yScroll Bug

I have noticed that this bug occurs on both the live site and the staging branch, but it happens much less consistently on the live site.

Recreation

We'll use the Cleric & Cleric subclasses pages in this example, but this behaviour can be observed on many routes.

0 - Spin up the staging branch on your local machine

1 - Visit /classes/cleric page. Scroll down until you see the subclasses. Note the y-scroll position.

2 - Click on one of the subclass links, ie. /classes/cleric/life-domain . Notice that you are not taken to the top of the page as you'd typically expect, but to the bottom of the page.

Desired Behaviour

When navigating to a new page, you could be taken to the top of that page.

@calumbell calumbell changed the title Bugfix: vertical scroll retained when navigating between pages Bug: vertical scroll retained when navigating between pages Feb 19, 2024
@christophermiles
Copy link
Contributor

I imagine this can be addressed by setting the scrollBehaviour property in the Vue Router config. There are various approaches to interacting with the Vue Router config in Nuxt. See nuxt/nuxt#14544 (comment)

Are we making any changes to the router options anywhere else? If so, would be best to set the scrollBehaviour there. As far as I can see, we don't yet have an app/router.options.ts file.

@calumbell
Copy link
Contributor Author

That looks like it could well be our problem, thanks for digging that up.

I have some time mid-week, i'll take a look into this then (unless it has already been fixed, or is assigned to somebody else)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants