Description
This is a UI/UX issue. ApiDetailPage.tsx is over 1,000 lines tall and users currently lose orientation when scrolling through Overview, Endpoints, Pricing, and Reviews. Add a sticky right-rail table of contents that highlights the active section via IntersectionObserver and supports keyboard jump-to.
Requirements and Context
- Reference:
src/pages/ApiDetailPage.tsx
- The TOC must collapse into a
<details> summary at <1024px so it does not steal width from content
- Active item must be styled via tokens and announced with
aria-current="location"
- Smooth scroll must respect
prefers-reduced-motion
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feature/api-detail-toc
- Implement changes
src/components/InPageToc.tsx — new component, accepts sections: { id, label }[]
src/pages/ApiDetailPage.tsx — render <InPageToc /> and add id anchors to each section heading
src/index.css — .toc, .toc__item--active styles using --accent and --text-muted
- Test and commit
- Manually verify section highlights track scroll position
- Tab through TOC and confirm focus styles + Enter activation
npm test to run existing tests
Example commit message
feat: add sticky in-page TOC to ApiDetailPage
Acceptance Criteria
Guidelines
- IntersectionObserver thresholds should not flicker between adjacent sections
- No layout shift on scroll — reserve space for the TOC rail
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
This is a UI/UX issue.
ApiDetailPage.tsxis over 1,000 lines tall and users currently lose orientation when scrolling through Overview, Endpoints, Pricing, and Reviews. Add a sticky right-rail table of contents that highlights the active section via IntersectionObserver and supports keyboard jump-to.Requirements and Context
src/pages/ApiDetailPage.tsx<details>summary at <1024px so it does not steal width from contentaria-current="location"prefers-reduced-motionSuggested Execution
src/components/InPageToc.tsx— new component, acceptssections: { id, label }[]src/pages/ApiDetailPage.tsx— render<InPageToc />and addidanchors to each section headingsrc/index.css—.toc,.toc__item--activestyles using--accentand--text-mutednpm testto run existing testsExample commit message
Acceptance Criteria
Guidelines