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: restore the sidebar position to make the selected entry showed #492

Closed
wants to merge 4 commits into from

Conversation

xue68
Copy link

@xue68 xue68 commented Nov 3, 2024

save and restore the sidebar position to make the selected entry showed. #490

Copy link

netlify bot commented Nov 3, 2024

Deploy Preview for hugo-hextra ready!

Name Link
🔨 Latest commit 06eb8a6
🔍 Latest deploy log https://app.netlify.com/sites/hugo-hextra/deploys/67386aafb5677300086ac0a6
😎 Deploy Preview https://deploy-preview-492--hugo-hextra.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Owner

@imfing imfing left a comment

Choose a reason for hiding this comment

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

btw, can you share the vitepress implementation you mentioned for saving the sidebar scroll position?

}

sidebarScrollbar.addEventListener('scroll', function() {
saveSidebarPosition();
Copy link
Owner

Choose a reason for hiding this comment

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

I think you need debouncing the event handler.

Copy link
Author

Choose a reason for hiding this comment

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

ok, I have add the new function.

@xue68
Copy link
Author

xue68 commented Nov 4, 2024

To be honest, I don't know how Vitepress is implemented, I'm just referring to the effects.

@imfing
Copy link
Owner

imfing commented Nov 7, 2024

There’s an issue after this change: switching between sidebar items would cause a noticeable jittering effect every time.

Screenshot.2024-11-07.at.12.48.02.mp4

Previous:

Screenshot.2024-11-07.at.12.49.04.mp4

@xue68
Copy link
Author

xue68 commented Nov 16, 2024

I've noticed this issue, but I've been struggling to figure out how to fix it. After testing, it is now possible to significantly reduce the frequency of occurrences.

@xue68 xue68 closed this Jan 1, 2025
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