Nodejs.dev: Scroll position on pages is not preserved

Created on 29 Nov 2019  路  8Comments  路  Source: nodejs/nodejs.dev

Description

When I am reading an article and click on a link and than go back (back button in browser) I would expect to land at the same reading position as I was before.

On plain HTML it works in browsers, this behaviour is probably caused by the site generator.

Steps to reproduce

Go to https://nodejs.dev/ and scroll to heading An Example Node.js Application.
Click on link standard library.
Hit back button in browser.

Expected result

I should see the heading An Example Node.js Application.

Actual result

I see top of the article.

Environment

  • OS Version: PopOS (Ubuntu) 19.04
  • Browser Version: Google Chrome 78
bug good first issue help wanted

All 8 comments

Getting the expected result require that you use the hyperlink to the header (just beside the heading to the left).

Not clicking the hyperlink results to the unexpected result

  • Browser version: Version 78.0.3904.87 (Official Build) (64-bit)

Yes, but that is not the point. You would never click that link unless you want to share the position with someone or save it for yourself, but that is another topic.

I tried experimenting with another site (stackoverflow) and expected behavior (going back to exactly where you were on the page) was true.

I think this is a valid issue now.

Hello! I'll try taking this one.

@seirina-of-js 馃憤馃徑

Hi @seirina-of-js have you been able to work on this issue?

Hi @benhalverson, I would like to take a look into this, but not sure how we want to track the scroll position. I was thinking of adding a header id as a hash in the URL as the user scroll or just keep/save the scroll position on local storage when a user scrolls.

Related: #236 #214

Hey @giankotarola it's lovely that you want to take a stab on that :] See here: Intersection Observer API . It's also used in the project somewhere. If you have further questions swing by the slack channel :]

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mmarchini picture mmarchini  路  4Comments

LaRuaNa picture LaRuaNa  路  4Comments

giankotarola picture giankotarola  路  4Comments

benhalverson picture benhalverson  路  4Comments

saulonunesdev picture saulonunesdev  路  4Comments