executablebooks / sphinx-book-theme

A clean book theme for scientific explanations and documentation with Sphinx
https://sphinx-book-theme.readthedocs.io
BSD 3-Clause "New" or "Revised" License
429 stars 198 forks source link

Clicking on the right sidebar scrolls it to the wrong position #733

Open Gouvernathor opened 1 year ago

Gouvernathor commented 1 year ago

image In this case, I clicked on article 6 in the right sidebar. As you can see, the main page's scrolling wen to the right place, placing article 6 on the top, but the right sidebar is lower than that for some reason and article 7 is shown as selected instead. It's also in advance generally when you scroll through the page using the mousewheel, but although that's acceptable in general, it becomes problematic when you click on a button and another button lights up...

Gouvernathor commented 1 year ago

In addition to the above behavior which was already present in the former version(s) of the theme, there is a new difference in behavior regarding the right sidebar. When in a subsection (here, an article) spanning some space, around 80% of the page's height, at some point the right sidebar will deselect the subsection indicator and leave only the section (the Titre here) selected and opened. This, when the subsection is located in the middle of the section, with plenty other subsections before and after. It's not great that the right sidebar forgets exactly where you are when you're too far from subsections. image image image

Gouvernathor commented 11 months ago

The first part of this issue has been solved at some point, apparently. The second one is still there.

choldgraf commented 10 months ago

My suspicion is that this is just a challenging UX issue to get right - you have to pick a semi-arbitrary point at which the "next section" is activated, based on where on the screen the next section hits. When you have sections that are very short, it starts to cause unpredictable behavior because the difference between "last section" and "next section" is very tiny in terms of scrolling position. I'm not sure that there's much we can do to fix this, other than choosing another semi-arbitrary y-position to trigger the section highlight change, but I suspect we'll still run into this issue.

Gouvernathor commented 9 months ago

Note that the issue title is misleading : that part is fixed, it's the second part that still happens.

To my naive understanding, there would be a sort of list of boundaries, each a y coordinate, which you would cross in succession, such that you're always between two boundaries, between the start of a section and the start of the following one (except maybe at the very top or bottom of the page). However you place that y boundary relative to the div's location, being between two sections and yet in neither of them is very weird.