Skip to content

fix(api-reference): align sidebar and content gutter with docs pages - #1301

Merged
twosugar merged 1 commit into
mainfrom
fix/api-reference-sidebar-align
Oct 23, 2026
Merged

twosugar merged 1 commit into
mainfrom
fix/api-reference-sidebar-align

Conversation

@twosugar

Copy link
Copy Markdown
Collaborator

Problem

On https://open.longbridge.com/docs/api the left menu sits flush against the viewport edge, unlike the docs pages where it lines up under the header logo. After fixing that, content-only API pages (e.g. Overview) also showed a large gap between the sidebar and the content, and a different gap than the docs pages on wide screens.

Cause, in packages/api-reference/src/api-reference.css (added in #1257):

  • .docs-layout { padding-left: 0 } overrode the docs gutter that aligns the sidebar with the logo.
  • .docs-content { margin-inline: auto } centered the column in the remaining width. With only auto margins the column also sized to its content and could overlap the right rail.
  • .docs-inner { max-width: none; margin: 0 } applied to every page, so content-only pages lost the docs 80rem cap + centering that sets the sidebar-to-content gap on wide screens.

Change

  • Remove the padding-left: 0 override; the sidebar uses the docs .docs-layout gutter.
  • .docs-content: keep max-width: 52rem, drop the auto margins (left-aligned after the sidebar, like docs).
  • .docs-inner goes full width only when the right rail is shown (has-rail, set from a single hasRail value in ApiReference.tsx); content-only pages keep the docs cap and centering.

Verification (local dev server, measured in the browser)

Viewport Page Sidebar right Breadcrumb left Text left
2000 /docs (docs) 636 710 742
2000 /docs/api 636 710 742
1512 /docs (docs) 392 424 —
1512 /docs/api 392 424 —
2000 /docs/api/list_news (rail) 636 content 668–1456, rail 1488–1968, no horizontal scroll

Also checked 1601 / 1700 / 1920 (rail inline, 32px gap, no overlap), 1280 (rail as drawer) and 375 (sidebar drawer, no horizontal scroll). Light/dark not checked (no color changes).

Trade-off: between ~1601px and ~2088px, endpoint pages with the inline rail have a narrower content column than before (e.g. 588px at 1601px), because the sidebar now has its docs gutter. Raising the inline-rail breakpoint above 1600px would avoid that but changes the rail interaction, so it is left as is.

🤖 Generated with Claude Code

The API Reference forced `.docs-layout` padding-left to 0 and
`.docs-inner` to full width on every page, so its sidebar sat flush
against the viewport edge instead of under the header logo, and the
content column was centered with auto margins, leaving a large gap
after the sidebar on content-only pages (e.g. /docs/api Overview).

- Drop the padding-left override so the sidebar uses the docs gutter.
- Left-align `.docs-content` (no auto margins); with auto margins it
  also sized to its content and overlapped the right rail at ~1600-2000px.
- Keep `.docs-inner` full width only on endpoint pages with the right
  rail (`has-rail`); content-only pages use the docs cap and centering,
  so the sidebar-to-content gap matches the docs pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@twosugar
twosugar merged commit f1c2c89 into main Oct 23, 2026
2 checks passed
@twosugar
twosugar deleted the fix/api-reference-sidebar-align branch October 23, 2026 09:06
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.

1 participant