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

New features for TOC #216

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

New features for TOC #216

wants to merge 1 commit into from

Conversation

foxton9
Copy link

@foxton9 foxton9 commented Oct 31, 2024

Glad to know new toc was released.

As in #103, I'd like to focus solely on adding features rather than the TOC widget itself.

New features for the existing toc

  1. active headings indicator
  2. synchronization with page scrolling

I think the implementation needs further discussion, as I'm not fully satisfied with the current solution.

It seems there will be some updates for the TOC on mobile and its styling, so I haven't tested those cases.

msedge_PT8flRFaeF

Copy link

vercel bot commented Oct 31, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
fuwari-yags ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 31, 2024 3:21am

@saicaca
Copy link
Owner

saicaca commented Nov 15, 2024

Thanks a lot for your contribution!
The features are great, but there are still some issues.

The logic of isPageReady may need to be revised:

  • When clicking on a post at the top of the page, the active headings are not set initially since there's no scroll to trigger the scrollend event. When using the mouse wheel, the event won't be fired until the user stops scrolling for the first time.
  • On top of that, if the post is short enough, some headings might never be marked as active because they never leave or enter the viewport.
Recording.2024-11-15.221415.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants