young-europe / Members-Platform-bug-reports

7 stars 0 forks source link

Odd retaining of scroll position #159

Open klarasch opened 2 years ago

klarasch commented 2 years ago

Describe the bug

The app sometimes oddly retains scroll position even when it's not supposed to.

Expected behaviour

In most scenarios, when a user clicks on a link / menu item, they expect to get to the start of the page, which doesn't happen.

Steps to reproduce the issue

E.G.

  1. Scroll so that "Wiki" menu item is approx. in the middle of the screen vertically.
  2. Click on "Welfare".
  3. Now the page does not "start at the top", the user musts scroll up in order to get to the beginning of the wiki page.

Technical details

This might be partly affected by my screen resolution / screen aspect ratio. I am on a 13,3" M1 Macbook Pro, this happens in Chrome while fullscreen (taking almost all vertical screen estate). I think this will not be reproducible on a big external display because there won't be the "vertical crop".

Possible Fix

Cannot suggest, don't have access rights to the source so cannot run/debug this locally:) Upon quick stackoverflowing it's probably something like scrollTo(0, 0); in some componentDidMount() or when handling route changes, but I haven't touched React the past two years, so dunno.

Additional information

This is not a major issue, only mildly odd UX behaviour. Google suggests it is something that needs to be handled manually in React apps though. However, gotta say I appreciate that the frontend of the Platform seems to be a swift React app :)