h5ai icon indicating copy to clipboard operation
h5ai copied to clipboard

feature request: save scroll position

Open Efreak opened this issue 2 years ago • 0 comments

At least on mobile, when browsing to a subdirectory and hitting the back button or selecting the parent folder, the scroll position resets from the last position. This makes it quite difficult to browser a large number of nested directories, as every time you go 'up', you have to scroll back to your previous position. On mobile, this is a particular pain due to the inconveniences of searching in a mobile browser (my usual method of giving where I was even I lose my position in a document is to search for the last thing I remember).

When navigating the directory structure, please save the scroll position with other state when changing directories, and restore it when navigating via history apis or to parent folders (by clicking the .. entry or a breadcrumb).

There's two ways to do for this, neither should be applied when clicking a directory by name (only history or ..):

  1. When navigating, save the element clicked, and scroll to the position of that item
  2. Better: In scroll events, save the resulting position. This allows restoring position even something unrelated to navigation occurs (tab is suspended, browser is restarted, etc). This is also a better solution, as solution 1 only ensures the item clicked is in the view, not that it's in the same place.

Efreak avatar Mar 25 '22 23:03 Efreak