Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scrolling behavior of the "Contents" sidebar is inaccurate, doesn't detect current section #607

Closed
grisaitis opened this issue Sep 3, 2022 · 3 comments
Labels
bug Something isn't working

Comments

@grisaitis
Copy link

Describe the bug

context
When I click on a section name under the "Contents" sidebar on the right...

expectation
I expected that section to be highlighted and any subsections expanded under the name.

bug
But instead:

  • the previous section shows up as currently viewed.
  • the problem is "solved" if i scroll down a little
    • (ie, only after scrolling down a smidge does the selected section become highlighted and expanded under "Contents")

problem
This is a problem for people navigating pages via the table of contents sidebar. Using the sidebar is useful for browsing large pages, but this issue makes navigation less user-friendly and sometimes very confusing.

Reproduce the bug

this can be seen on any site built with this sphinx theme. For example, in the docs for this project, it can be seen at: https://sphinx-book-theme.readthedocs.io/en/stable/customize/sidebar-primary.html#customize-the-sidebar-footer

addendum - potential causes

  • when selecting a section (e.g. opening a URL like page.html#section-name), i think the page needs to be scrolled down a few pixels more. Currently, the last few pixels of the previous section are still visible.
  • Maybe this is related to MAINT: Simplify toc scrolling behavior #448 and the IntersectionObserver API. Maybe a pixel offset needs to be adjusted somewhere?
    • I tried modifying sphinx-book-theme.js to have e[0].boundingClientRect.y<-20, or also -200, but noticed no change in the ui.

note
i opened an issue about this at jupyter-book/jupyter-book#1827. But I think this repo is the correct place to open this.

List your environment

No response

@grisaitis grisaitis added the bug Something isn't working label Sep 3, 2022
@welcome
Copy link

welcome bot commented Sep 3, 2022

Thanks for opening your first issue here! Engagement like this is essential for open source projects! 🤗

If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.

If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).

Welcome to the EBP community! 🎉

@choldgraf
Copy link
Member

Yep - thanks for noticing this. I believe this is a duplicate of the issue below, feel free to re-open if you think it's different!

@grisaitis
Copy link
Author

thank you! yes, it is indeed a dupe.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants