Scrollbar jumps on sorting without user-selected items
A.K.A. "When "Sort folders before files" is enabled, and when no file is visibly selected¹ by the user, do not auto-scroll using the invisibly focused² item when sorting the listview".
Affected version
- Nightly flatpak: Yes, built the git version with existing sorting fixes (from Peter and Corey) in addition to testing 43.2
- Other: Nautilus 43.2 package from Fedora 37
Steps to reproduce
- Make sure the "Sort folders before files" settings is enabled
- Go to a folder that has many folders and files, preferrably in listview mode
- Do not select anything
- Repeatedly click the various column headers to sort by modified time or name, alternating between ascending and descending sort order for each
Current behavior
See this short demonstration video: https://youtube.com/watch?v=xjcwpS7EypU
As seen in the video above, the scrollbar jumps around unpredictably, due to some arbitrary behind-the-scenes invisible "focus" pre-selection that acts as an auto-scroll anchor, and it seems the sorting is making the folders fight with files. It is visually nearly impossible to keep track of what is going where.
In the video above, it sometimes uses the "tagtheora" folder as an anchor or the "installateur-ubuntu" file as an anchor, even though they were not selected and they were not the 1st item in the list when loading the list. Sometimes the "logic" is somewhat visible with certain types of sorting (if you have a very sharp eye), and sometimes not at all, so to the unsuspecting user it appears to not make any sense.
In the current state of things, the current behavior feels "broken", unpredictable, and frustrating:
- I'm completely disorientated everytime I change the sorting order, which is the opposite of the desired outcome that Nautilus is attempting to create.
- It also makes me spend extra efforts to manually scroll back to where I was (ex: at the top, or the bottom, or the junction between files and folders) every time.
Expected behavior
Do not touch the scrollbar when changing sorting order, particularly when the user has not explicitly selected files or folders in the view.
Personally, I was also happy with the pre-43x behavior of "not automatically touching the scrollbar on sort, at all, ever" (if I recall correctly). It might have been a bit less smart in attempting to guess the user's "intent", but it was also error-free; this kind of intent guessing is certainly pretty hard to get 100% right.
Additional information
- The issue occurs both in list view and grid view, though it is much easier to notice in listview mode.
- The issue will not occur (or at least not as badly) if you disable "Sort folders before files" in the preferences... but who does that?! ;)
- ¹: by "selection", I mean the user-visible blue selection highlight that happens when you select items with the keyboard or mouse;
- ²: by "focus", I mean what's going on behind the scenes, where Nautilus (or GTK?) silently pre-selects the first file of the view to allow keyboard navigation. In theory, the "focus" is the first item in the folder (upon loading) if you didn't click anything, but in practice, that doesn't seem to be the case either.