Fix docs nav dropdown rendering off-screen with large fonts on Android Chrome#29583
Conversation
…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>
There was a problem hiding this comment.
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: hiddenonhtmland to suppress Chrome text inflation viatext-size-adjust. - Changes the header dropdown to use
position: fixedand 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
| // 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); |
| // 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'); | ||
|
|
🧪 Test Quality Sentinel ReportTest Quality Score: N/A
Language SupportTests analyzed:
Observed test (
Verdict
|
There was a problem hiding this comment.
✅ 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.
|
@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>
Both reviewer comments addressed in 592dbc7:
|
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:
overflow-x: hiddenonhtml(not justbody) — breaksposition: fixedoverlays on mobile Chrometext-size-adjust— Chrome's automatic text inflation shifted header items out of their flex positions.tablet-dropdownusedposition: absolute; right: 0relative to a potentially-displaced parentChanges
custom.cssbody, html { overflow-x: hidden }— removes the property fromhtml, retains it onbody-webkit-text-size-adjust: 100%; text-size-adjust: 100%to:rootto suppress automatic font inflationCustomHeader.astro.tablet-dropdowntoposition: fixedwithmax-width: calc(100vw - 2rem)positionDropdown()— called on each open, usesgetBoundingClientRect()on the button to compute viewport-relativetop/right, clamped to stay on-screen; falls back to left-alignment when right-align would clipmobile-responsive.spec.ts— adds regression test that injectsfont-size: 20pxonhtmland asserts the opened dropdown's bounding box stays within the 393px viewport