Skip to content

Fix docs nav dropdown rendering off-screen with large fonts on Android Chrome#29583

Merged
pelikhan merged 3 commits into
mainfrom
copilot/deep-report-triage-accessibility-issue
May 1, 2026
Merged

Fix docs nav dropdown rendering off-screen with large fonts on Android Chrome#29583
pelikhan merged 3 commits into
mainfrom
copilot/deep-report-triage-accessibility-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 1, 2026

On Android Chrome with OS-level large font accessibility settings, the header navigation dropdown appeared off to the side of the viewport. Three compounding causes:

  1. overflow-x: hidden on html (not just body) — breaks position: fixed overlays on mobile Chrome
  2. No text-size-adjust — Chrome's automatic text inflation shifted header items out of their flex positions
  3. .tablet-dropdown used position: absolute; right: 0 relative to a potentially-displaced parent

Changes

  • custom.css

    • Split body, html { overflow-x: hidden } — removes the property from html, retains it on body
    • Adds -webkit-text-size-adjust: 100%; text-size-adjust: 100% to :root to suppress automatic font inflation
  • CustomHeader.astro

    • Switches .tablet-dropdown to position: fixed with max-width: calc(100vw - 2rem)
    • Adds positionDropdown() — called on each open, uses getBoundingClientRect() on the button to compute viewport-relative top/right, clamped to stay on-screen; falls back to left-alignment when right-align would clip
function positionDropdown() {
  const VIEWPORT_EDGE_PADDING = 8;
  const rect = hamburgerBtn.getBoundingClientRect();
  let right = Math.max(window.innerWidth - rect.right, VIEWPORT_EDGE_PADDING);
  tabletDropdown.style.top = `${rect.bottom + VIEWPORT_EDGE_PADDING}px`;
  tabletDropdown.style.right = `${right}px`;
  // flip to left-align if dropdown would bleed off the left edge
  if (window.innerWidth - right - dropdownWidth < VIEWPORT_EDGE_PADDING) {
    tabletDropdown.style.left = `${Math.max(rect.left, VIEWPORT_EDGE_PADDING)}px`;
    tabletDropdown.style.right = 'auto';
  }
}
  • mobile-responsive.spec.ts — adds regression test that injects font-size: 20px on html and asserts the opened dropdown's bounding box stays within the 393px viewport

…hrome (#29545)

- Add -webkit-text-size-adjust/text-size-adjust: 100% to :root to prevent
  Android Chrome from auto-inflating text sizes that break the header layout
- Remove overflow-x:hidden from html (keep only on body) to fix position:fixed
  overlays being clipped on Android Chrome with large user fonts
- Change .tablet-dropdown to position:fixed with viewport-clamped JS positioning
  using getBoundingClientRect() so it always renders within the visible viewport
- Add regression test simulating large font scaling on a narrow mobile viewport

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/4a2da3c3-feeb-4d4b-952f-cb039ee7a348

Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Copilot AI changed the title [WIP] Triage unlabeled community issue for docs accessibility problem Fix docs nav dropdown rendering off-screen with large fonts on Android Chrome May 1, 2026
Copilot AI requested a review from gh-aw-bot May 1, 2026 17:43
@pelikhan pelikhan marked this pull request as ready for review May 1, 2026 18:20
Copilot AI review requested due to automatic review settings May 1, 2026 18:20
Copy link
Copy Markdown
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

Fixes the docs header navigation dropdown rendering off-screen on Android Chrome when OS-level large font accessibility settings are enabled.

Changes:

  • Updates global CSS to avoid overflow-x: hidden on html and to suppress Chrome text inflation via text-size-adjust.
  • Changes the header dropdown to use position: fixed and adds JS logic to compute/clamp dropdown placement to the viewport.
  • Adds a Playwright regression test asserting the dropdown stays within the viewport under simulated large font sizing.
Show a summary per file
File Description
docs/tests/mobile-responsive.spec.ts Adds a regression test for hamburger dropdown viewport bounds under large-font conditions.
docs/src/styles/custom.css Adjusts overflow handling and adds text-size-adjust rules to mitigate Android Chrome text inflation/layout shifts.
docs/src/components/CustomHeader.astro Switches dropdown to fixed positioning and introduces JS-driven viewport-relative positioning/clamping on open.

Copilot's findings

Tip

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

  • Files reviewed: 3/3 changed files
  • Comments generated: 2

Comment thread docs/src/components/CustomHeader.astro Outdated
Comment on lines +156 to +160
// Keep this in sync with the CSS min-width on .tablet-dropdown (180px).
const MIN_DROPDOWN_WIDTH = 180;

const rect = hamburgerBtn.getBoundingClientRect();
const dropdownWidth = Math.max(MIN_DROPDOWN_WIDTH, tabletDropdown.scrollWidth);
Comment thread docs/tests/mobile-responsive.spec.ts Outdated
Comment on lines +175 to +180
// Simulate large OS-level font scaling by overriding the root font size.
await page.addStyleTag({ content: 'html { font-size: 20px !important; }' });

await page.goto('/gh-aw/introduction/overview/');
await page.waitForLoadState('networkidle');

@github-actions github-actions Bot mentioned this pull request May 1, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 1, 2026

🧪 Test Quality Sentinel Report

Test Quality Score: N/A

i️ Outside Analysis Scope — no Go or JavaScript test files were modified in this PR.

Metric Value
New/modified tests analyzed 0 (Go + JavaScript)
�� Go (*_test.go) 0
🟨 JavaScript (*.test.cjs, *.test.js) 0
🔷 TypeScript/Playwright (*.spec.ts) 1 (detected, not scored)

Language Support

Tests analyzed:

  • 🐹 Go (*_test.go): 0 tests
  • 🟨 JavaScript (*.test.cjs, *.test.js): 0 tests (vitest)

i️ One TypeScript/Playwright test was found in docs/tests/mobile-responsive.spec.ts but is outside the current analysis scope (Go and JavaScript supported).

Observed test (docs/tests/mobile-responsive.spec.ts):

  • hamburger dropdown stays within viewport with large user fonts — a regression test for issue Docs problem on android Chrome with large user fonts #29545 that simulates Android Chrome large-font accessibility scaling and asserts the navigation dropdown bounding box stays within the viewport. This appears to be a high-value behavioral contract test that directly guards the fix introduced in this PR.

Verdict

Check passed. No Go or JavaScript test files were modified. The TypeScript/Playwright regression test added is outside the scoring scope but appears to be a high-quality behavioral test directly validating the fix.

🧪 Test quality analysis by Test Quality Sentinel · ● 404.7K ·

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

✅ Test Quality Sentinel: N/A. No Go or JavaScript test files were modified. The TypeScript/Playwright regression test added is outside scoring scope but appears high-quality — it directly validates the behavioral fix for issue #29545.

@pelikhan
Copy link
Copy Markdown
Collaborator

pelikhan commented May 1, 2026

@copilot review all comments

…ag after goto

- CustomHeader.astro: replace hardcoded MIN_DROPDOWN_WIDTH constant with
  parseFloat(getComputedStyle(tabletDropdown).minWidth) so JS stays in sync
  with the CSS min-width automatically
- mobile-responsive.spec.ts: move page.addStyleTag() to after page.goto() so
  the document exists when the style tag is attached

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/b15435f5-4574-4e10-acb7-25158894d3b1

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 1, 2026

@copilot review all comments

Both reviewer comments addressed in 592dbc7:

  • MIN_DROPDOWN_WIDTH sync issue: replaced the hardcoded constant with parseFloat(getComputedStyle(tabletDropdown).minWidth) || 0 so the JS automatically reads the value from CSS — no manual sync needed.
  • addStyleTag before navigation: moved page.addStyleTag() to after page.goto() + waitForLoadState('networkidle') so the document is ready when the style tag is attached.

Copilot AI requested a review from pelikhan May 1, 2026 18:51
@pelikhan pelikhan merged commit 713a323 into main May 1, 2026
@pelikhan pelikhan deleted the copilot/deep-report-triage-accessibility-issue branch May 1, 2026 19:10
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.

[deep-report] Triage unlabeled community issue #29545 — Docs accessibility problem on Android Chrome

4 participants