Skip to content

fix(docs): tablet hamburger nav + mobile animation/code-wrap improvements#21513

Merged
pelikhan merged 2 commits intomainfrom
copilot/fix-header-navigation-overflow
Mar 18, 2026
Merged

fix(docs): tablet hamburger nav + mobile animation/code-wrap improvements#21513
pelikhan merged 2 commits intomainfrom
copilot/fix-header-navigation-overflow

Conversation

Copy link
Contributor

Copilot AI commented Mar 18, 2026

7 header links overflow on iPad-sized viewports (769–900px). Mobile also runs a heavy animated radial gradient and inline code can cause horizontal scroll.

Changes

docs/src/components/CustomHeader.astro

  • Added a CSS hamburger button + absolutely-positioned dropdown <nav> rendered alongside the existing full nav
  • Dropdown mirrors all 7 links; shown only at 769–900px via global CSS
  • Accessible: aria-expanded, aria-controls, hidden, Escape-to-close, focus moves to first link on open, outside-click dismissal
  • Reinitializes on astro:page-load for Starlight view transitions

docs/src/styles/custom.css

  • Tablet block (769–900px): full nav hidden (display: none !important), .tablet-nav-wrapper shown (display: flex !important)
  • Mobile block (≤768px): added animation: none on :root[data-theme='light'] body::before to stop the light-glow-move radial gradient on mobile
  • Mobile block (≤768px): added word-break: break-word to .sl-markdown-content code (inline code); previously only pre code was covered

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

- Add hamburger/dropdown nav to CustomHeader.astro for 769–900px tablets
  to prevent the 7-link header from overflowing on iPad-size viewports.
  Includes ARIA attributes, keyboard (Escape) support, outside-click
  dismissal, focus management, and astro:page-load re-initialization.
- Hide full nav at 769–900px in custom.css and show .tablet-nav-wrapper
- Disable light-glow-move background animation on mobile (≤768px) to
  reduce CPU/battery usage
- Add word-break: break-word to inline code on mobile to prevent
  horizontal overflow

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] [§23226379507] Fix header navigation overflow on tablets fix(docs): tablet hamburger nav + mobile animation/code-wrap improvements Mar 18, 2026
Copilot AI requested a review from pelikhan March 18, 2026 03:00
@pelikhan pelikhan marked this pull request as ready for review March 18, 2026 03:02
Copilot AI review requested due to automatic review settings March 18, 2026 03:02
@pelikhan pelikhan merged commit d661d20 into main Mar 18, 2026
@pelikhan pelikhan deleted the copilot/fix-header-navigation-overflow branch March 18, 2026 03:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Improves docs-site responsiveness by reducing overflow on small screens and adding a tablet-specific hamburger navigation to prevent header link overflow.

Changes:

  • Add additional mobile overflow mitigations (inline code wrapping) and attempt to disable background animation on mobile.
  • Replace tablet header overflow tweaks with a tablet-only hamburger menu (769–900px).
  • Add hamburger dropdown markup, styling, and client-side toggle behavior in the custom header component.

Reviewed changes

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

File Description
docs/src/styles/custom.css Adds mobile wrapping rules and tablet media-query behavior to swap full nav for hamburger
docs/src/components/CustomHeader.astro Introduces tablet hamburger dropdown navigation, styling, and initialization script

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

You can also share your feedback on Copilot code review. Take the survey.

}

/* Disable heavy background animation on mobile to reduce CPU/battery usage */
:root[data-theme='light'] body::before {
Comment on lines +138 to +171
function initHamburgerMenu() {
const hamburgerBtn = document.querySelector<HTMLButtonElement>('.hamburger-btn');
const tabletDropdown = document.querySelector<HTMLElement>('.tablet-dropdown');

if (!hamburgerBtn || !tabletDropdown) return;

hamburgerBtn.addEventListener('click', (e) => {
e.stopPropagation();
const isOpen = hamburgerBtn.getAttribute('aria-expanded') === 'true';
hamburgerBtn.setAttribute('aria-expanded', String(!isOpen));
tabletDropdown.hidden = isOpen;
// Move focus to first link when opening for keyboard accessibility
if (!isOpen) {
const firstLink = tabletDropdown.querySelector<HTMLAnchorElement>('.dropdown-link');
firstLink?.focus();
}
});

// Close when clicking outside the menu
document.addEventListener('click', (e) => {
if (!hamburgerBtn.contains(e.target as Node) && !tabletDropdown.contains(e.target as Node)) {
hamburgerBtn.setAttribute('aria-expanded', 'false');
tabletDropdown.hidden = true;
}
});

// Close on Escape key only when dropdown is open, for keyboard accessibility
document.addEventListener('keydown', (e) => {
if (e.key === 'Escape' && hamburgerBtn.getAttribute('aria-expanded') === 'true') {
hamburgerBtn.setAttribute('aria-expanded', 'false');
tabletDropdown.hidden = true;
hamburgerBtn.focus();
}
});
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.

🔍 Multi-Device Docs Testing Report - 2026-03-18

3 participants