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

Fix sidebar section highlighter #1909

Merged
merged 2 commits into from
Dec 10, 2024
Merged

Conversation

doup
Copy link
Contributor

@doup doup commented Dec 5, 2024

Apply the header offset to on-this-page.js intersection observer. This way the sidebar will highlight the next section as soon as the old section gets below the header. Previously it waited until exiting the viewport.

Fixes #1908.

New behavior (header opacity reduced to 0.5 and yellow header just for visualization)

fix-on-this-page-highlight.mp4

@doup
Copy link
Contributor Author

doup commented Dec 5, 2024

I couldn't resist, an easy fix. Hopefully improves the feeling. 🙈

@rparrett
Copy link
Contributor

rparrett commented Dec 5, 2024

I wonder if something else is going on as well -- this is what I'm seeing on my end with this PR:

sidebar.mp4

@doup
Copy link
Contributor Author

doup commented Dec 5, 2024

Hahaha, OK, that's really broken. It's not because of the header offset feeling.
My videos where in Firefox, but now I've checked in Chrome and Safari and I see the same issue.

@doup doup changed the title Fix sidebar section highlighter wonky feeling Fix sidebar section highlighter Dec 5, 2024
@doup
Copy link
Contributor Author

doup commented Dec 5, 2024

@rparrett I think now is fixed. The sorting of the visible headings was broken, which caused to highlight the last visible heading, not the first one.

This is in Safari:

fix-sidebar-safari.mp4

Copy link
Contributor

@rparrett rparrett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Working well in my browsers.

@rparrett rparrett added C-Bug A problem with the code that runs the site C-Webdev D-Straightforward labels Dec 9, 2024
Copy link
Member

@cart cart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works in firefox and chromium for me on linux. Big win. Thanks!

@cart cart added this pull request to the merge queue Dec 10, 2024
Merged via the queue into bevyengine:main with commit a5edaef Dec 10, 2024
10 checks passed
@doup doup deleted the fix-on-this-page-offset branch December 10, 2024 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-Bug A problem with the code that runs the site C-Webdev D-Straightforward
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Table of contents in sidebar feels wonky
3 participants