feat(docs-portal): sticky nav bar with active section highlighting#143
Open
adepoju2006 wants to merge 1 commit into
Open
feat(docs-portal): sticky nav bar with active section highlighting#143adepoju2006 wants to merge 1 commit into
adepoju2006 wants to merge 1 commit into
Conversation
Scaffold the Docusaurus docs portal (expected by the api-docs-portal workflow) and add a sticky in-page section navigation with scroll-spy: - useScrollSpy: IntersectionObserver hook, SSR-safe, topmost-visible wins - ScrollSpyNav: sticky nav, active highlight, smooth scroll (reduced-motion aware), aria-current, focus management - WCAG 2.1 AA contrast for active/inactive states (light + dark), active also signalled by weight + underline (not color alone) - Demo home page wiring the nav to on-page sections, intro doc Verified: npm install, npm run build (clean), npm run typecheck all pass.
|
@adepoju2006 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Close #89
Summary
Adds a sticky in-page section navigation bar with scroll-spy active highlighting to the docs portal.
This also scaffolds the
docs-portal/Docusaurus site itself — theapi-docs-portal.ymlworkflow already expected adocs-portal/directory (it runsnpm run buildthere), but the directory did not exist in the repo. This PR creates it and implements the feature inside it.What's included
useScrollSpy.ts— anIntersectionObserver-based hook that returns the id of the section currently in view. SSR-safe (all DOM access insideuseEffect); when multiple sections are visible at once, the topmost in document order wins.ScrollSpyNav/index.tsx— the sticky<nav>component: active-link highlighting, click → smooth scroll, URL hash sync, and focus moved to the target section for keyboard / screen-reader users.styles.module.css—position: stickypinned below the Docusaurus navbar at every breakpoint (horizontal scroll on mobile), with WCAG-AA color states.src/pages/index.tsx— demo home page wiring the nav to six on-page sections so the behavior is visible and testable.docusaurus.config.ts,sidebars.ts,tsconfig.json,babel.config.js,src/css/custom.css,docs/intro.md, logo, README.Acceptance criteria
position: sticky; top: var(--ifm-navbar-height); list scrolls horizontally below 600pxuseScrollSpy+IntersectionObserverapply.linkActive+aria-currentscrollIntoView({ behavior: 'smooth' }), honorsprefers-reduced-motion#44474e/#d0d3d9(~8.9–12:1), active white on#1d4ed8(~6.6:1); active also signalled by weight + underline, not color aloneAccessibility notes
aria-current="true"on the active link;aria-labelon the nav landmark.prefers-reduced-motion(both the JS smooth-scroll and CSSscroll-behavior).Verification
npm installnpm run build(clean, no warnings — generatesbuild/index.html, matching what CI uploads)npm run typecheckHow to test locally