fix(preview): wrap the showcase nav so it fits a 320px phone - #70
Merged
Merged
Conversation
preview/icons.html scrolled sideways at 320px (scrollWidth 336). The nav is a nowrap flex row, so it cannot shrink past the sum of each link's narrowest word plus gaps (71+71+50+71 + 3x16 = 312px against a 272px content box). Every link was already squeezed to that word, so each command also split after its "--" onto two or three lines. components.html and index.html had the same defect, hidden: their narrower "--icons" label gives a 277px floor, which overflows the content box by 4.7px into the page padding and still splits every command. - nav wraps between links (flex-wrap: wrap), so each command stays whole and the row's floor is the single widest link - row gap 8 on 16px lines = 24px pitch, the web target-size floor - icons.html nav links take the label line-height like the other two pages (they inherited 24px body line-height) - tests/browser/showcase.spec.ts renders all three pages at 320/360/375/ 1440 and asserts no sideways scroll and one line per nav command; it failed 9 of 12 before this change and passes 12 of 12 after
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
preview/icons.htmlscrolls sideways at a 320px viewport:document.documentElement.scrollWidthis 336. The overflowing elements are the headernavand its last link (right edge 336px). This predates #69.Root cause
The nav is a
display: flexrow with the defaultflex-wrap: nowrap. At phone widths each link shrinks to its narrowest unbreakable word (foundation,components,devslab.kr). The row can't get narrower than the sum of those words plus the gaps, and as a flex item ofheader.siteit keepsmin-width: auto:So components.html only looked fine at 320. It has the same defect, and on all three pages every command was split after its
--onto 2–4 lines (> ./dds --/foundation).Fix
The same rule on all three pages, since it's one nav repeated across them:
flex-wrap: wrapon the nav. Wrapped flex items start at their full width, so each command moves to the next row as a unit, and the row's floor becomes the single widest link (about 142px).--dds-space-8. On 16px lines that gives a 24px pitch, the web target-size floor (WCAG 2.5.8 spacing).--dds-typo-label-line-heightlike the other two pages. Before, they inherited the 24px body line height, so the same nav was a different height on one page.icons.html and components.html use
--dds-*tokens only. index.html keeps its own hardcoded px convention, andgap: 8px 16pxmatches itsheader.site.Verification
tests/browser/showcase.spec.ts(added to the foundation Playwright config, so CI runs it). It renders all three pages at 320 / 360 / 375 / 1440 and asserts no sideways scroll and one line per nav command. 9 of 12 failed before the change, 12 of 12 pass after. The pages are served from disk under a stand-in origin because icons.html importsicons.jsas an ES module.scrollWidthAt 360 and 375 all three pages wrap into 2 rows. At 1440 it stays one row, unchanged. Every row starts on the content's left edge, and the pitch is a uniform 24px.
node --test tests/foundation-contracts.test.mjs: 11/11pnpm run verify: exit 0 (docs sync, including preview/index.html vs tokens, is in sync)pnpm run verify:foundation: 21 passedpnpm run verify:source:stage1-2: 22/22Follow-up
devslab.kr vendors these pages to
/dds/. After merge, resync there withDDS_REPO=<dds on main> node scripts/sync-dds-showcase.mjsin its own PR.