Skip to content

docs: improve mobile layout and small-screen readability - #81

Merged
Roger-luo merged 2 commits into
mainfrom
docs/mobile-layout
May 18, 2026
Merged

Roger-luo merged 2 commits into
mainfrom
docs/mobile-layout

Conversation

@Roger-luo

@Roger-luo Roger-luo commented May 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a hamburger drawer to the masthead so the 5-item nav + theme toggle stops overflowing on phones; hides .brand-sub and tightens masthead padding below 720 px.
  • Converts .page-toc, .page-sections, and .api-toc from <aside> to <details class="side-nav"> so they collapse on mobile. An inline script forces them open at ≥ 901 px, preserving the desktop look; on mobile the summary becomes a tappable disclosure with a chevron, and the redundant right-hand "On this page" TOC is hidden ≤ 900 px since the left "Sections" rail already lists everything.
  • Tightens global type & spacing at ≤ 720 px (body 16 px, clamped h1, reduced .shell / hero / pre / titleblock padding, atom-cloud faded to 55 %). Footer stacks at ≤ 540 px; theme-toggle buttons grow to a 34 × 30 px tap target.
  • Adds a section pager (prev/next links) that the layout auto-generates from the existing sections + currentSection props — currently used by the Python Quick Start. Placeholder column keeps the grid balanced on the first/last sections.
  • Adds a back-to-top floating pill that fades in past max(viewportHeight × 1.2, 600 px) and smooth-scrolls to the top, returning focus to the brand for keyboard users.
  • Per request, both the section pager and back-to-top are shown only at ≤ 900 px, where the sidebars collapse and inline navigation aids actually matter.

Test plan

  • Open / on a phone-width viewport (≤ 720 px): brand-sub hidden, hamburger toggles a stacked drawer, theme toggle reachable inside the drawer.
  • /quickstart/python, /quickstart/python/tableau, /quickstart/python/next-steps: section pager renders with the correct prev/next labels (and an empty cell for the first / last section).
  • On desktop ≥ 901 px: TOCs render identically to before (sticky, no disclosure widget), section-pager and back-to-top are hidden.
  • /develop: scroll past ~1.2× the viewport on a phone-width window — back-to-top fades in; tapping it smooth-scrolls to the top.
  • /api: API TOC opens on desktop, collapses on mobile; filter + lang toggle still work inside the disclosure.

🤖 Generated with Claude Code

Adds a hamburger drawer to the masthead so the nav stops overflowing
on phones, converts the sidebar TOCs to collapsible <details> elements
that stay open on desktop, and tightens type/spacing below 720 px.

For the Python Quick Start (and any future multi-section walk-through),
adds a prev/next section pager generated from the existing sections
array and a floating back-to-top button — both shown only at ≤ 900 px
where the sidebars collapse and inline navigation aids matter.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 18, 2026 17:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Documentation site receives a mobile-friendly refresh: the masthead gains a hamburger drawer, sidebar TOCs collapse into <details> disclosures on narrow viewports, and global type/spacing is tightened ≤ 720 px. A reusable section-pager (auto-derived from sections/currentSection) and a fade-in back-to-top button are added for small screens.

Changes:

  • Convert sidebar TOCs (.page-toc, .page-sections, .api-toc) from <aside> to <details class="side-nav">, with an inline script forcing them open at ≥ 901 px and a chevron + collapsed default on mobile.
  • Add a mobile nav hamburger drawer, mobile typography/spacing tweaks, footer stacking, and a back-to-top floating button (shown ≤ 900 px past ~1.2× viewport scroll).
  • Add an automatic prev/next section pager rendered by Base.astro when sections + currentSection are present.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
docs/src/styles/global.css New CSS for section pager, back-to-top, side-nav disclosure, hamburger drawer, and small-screen typography/spacing.
docs/src/pages/api.astro Wrap API TOC <aside> in a <details class="api-toc side-nav"> with a summary so it collapses on mobile.
docs/src/layouts/Base.astro Compute prev/next sections; emit hamburger button, section pager, back-to-top; add inline JS to sync disclosure open-state and drawer interactions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +216 to +222
const sideNavs = document.querySelectorAll("details.side-nav");
function syncSideNavs() {
for (const d of sideNavs) {
if (mq.matches) d.setAttribute("open", "");
else d.removeAttribute("open");
}
}
Comment thread docs/src/layouts/Base.astro Outdated
Comment on lines +244 to +248
if (target && target.tagName === "A") setOpen(false);
});
// Reset state when crossing the breakpoint.
const mqNav = window.matchMedia("(min-width: 721px)");
mqNav.addEventListener("change", () => setOpen(false));
@github-actions

github-actions Bot commented May 18, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-05-18 17:52 UTC

Disable pointer events on the side-nav summary above the mobile
breakpoint so a stray click on desktop can't collapse the sidebar TOC,
and re-enable them inside the mobile media query. Also use
`closest("a")` for the nav-link delegation so it stays correct if a
link ever wraps an icon.

Addresses Copilot review comments on #81.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Roger-luo
Roger-luo merged commit 4b794b0 into main May 18, 2026
8 checks passed
@Roger-luo
Roger-luo deleted the docs/mobile-layout branch May 18, 2026 17:52
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