Scroll Recording bug

Vuchan
0
Vuchan
commented 8 months ago

Version

latest

Reproduction link

https://nuxtjs.org/guide/views#layouts

Steps to reproduce

Because of this doc web is a SPA, when i changed the link it will recording the previous page scroll-top value, and the next page will auto position there.

For Example:

  1. if i have been scrolling to this pos: https://nuxtjs.org/guide/views#layouts,
  2. but i want to skip the rest content of this article and clicked the others link which one is not sub menu under the 'views' menu, at here if i click 'async data' link, it shows me the content does not start at the page position scroll-top 0, it shows me the content start at subtitle 'Handling Errors', it is not what i expect.

So, please fix it to give the other people more better experience, My ENGLISH is not good, if somewhere has any error, please excuse me the grammar was so bad .

in fact, i have met this bug when i use VUE.js written an application in our company's backend front page.

i have a recommend solution, may u have a better? but choose which one was depending on you.

when user has already viewed any path and going to leave current page to go to anther one, at this time, to get the scroll-top value of the main content container:

const scrollTopRecording = {}

const scrollTopVal = document.querySelector(yourContainer)
const path = route.path
scrollTopRecording[path] = scrollTopVal

and when into the another one page:
document.querySelector(yourContainer).scrollTop = scrollTopRecording[antherPage.path] || 0

What is expected ?

Could see it at 'Steps to reproduce *'

What is actually happening?

Could see it at 'Steps to reproduce *'

Additional comments?

The bug form has too many fields, right?

bug
0

Fixed

4 months ago by Atinux

It's now fixed, thanks @Vuchan

0
Informations
Bug Report โ€ข Fixed
#c117 - Created 8 months ago