Fix: highlight the elements in table of contents on the right side of the documentation page with scroll#474
Conversation
… the documentation with respect to scroll Signed-off-by: codeEvolveZenith345 <suntiwari3495@gmail.com>
Summary of ChangesHello @codeEvolveZenith345, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience for documentation pages by introducing dynamic highlighting in the Table of Contents. As users scroll through a document, the corresponding section in the ToC will now automatically become active, making it much easier to track their position and navigate long articles. This change addresses a previous limitation where the ToC remained static, improving overall usability and accessibility. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a scroll-spy feature for the documentation's table of contents, which is a great enhancement for user navigation on long pages. The implementation using IntersectionObserver is modern and efficient. The code is well-structured, but I've identified several opportunities to modernize the JavaScript syntax to ES6+ standards. My suggestions focus on using const/let instead of var, adopting arrow functions, and using modern array methods. I've also pointed out some "magic numbers" that could be extracted into constants for better readability and maintainability. These changes will improve the overall quality and future-proofing of the new script.
|
/cc @Arhell Please review it. |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: JesseStutler The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
The documentation table of contents (ToC) now highlights the current section as users scroll through the page, providing better navigation feedback on long documentation pages.
/kind bug
/kind feature
This PR implements scroll-spy functionality for the documentation ToC using the Intersection Observer API. Currently, the ToC remains static while scrolling, making it difficult for users to track their position in long documents. This enhancement automatically highlights the visible section in the ToC as users scroll.
Implementation:
Files changed: 4 files, 1 new file 3 modified
Fixes #473
Before(Bugged)
scrollhighbefore.mp4
After (Fixed)
scrollHighlightAfter.mp4