From 1763f09a899a1e2d38f12e46cb5b75951d1426bb Mon Sep 17 00:00:00 2001 From: ahauy Date: Fri, 6 Nov 2026 12:23:06 +0700 Subject: [PATCH 1/4] fix(web): move header actions into a drawer with 44px touch targets --- web/src/components/BackToTop.astro | 6 - web/src/components/Footer.astro | 22 ++- web/src/components/Header.astro | 265 ++++++++++++++++++--------- web/src/components/ThemeToggle.astro | 7 + 4 files changed, 200 insertions(+), 100 deletions(-) diff --git a/web/src/components/BackToTop.astro b/web/src/components/BackToTop.astro index 68755b1..8dc83b7 100644 --- a/web/src/components/BackToTop.astro +++ b/web/src/components/BackToTop.astro @@ -118,12 +118,6 @@ const label = t.a11y.backToTop; .back-to-top-btn { bottom: 20px; right: 20px; - width: 40px; - height: 40px; - } - .progress-ring { - top: 1px; - left: 1px; } } diff --git a/web/src/components/Footer.astro b/web/src/components/Footer.astro index fb285b3..974d1ad 100644 --- a/web/src/components/Footer.astro +++ b/web/src/components/Footer.astro @@ -141,7 +141,7 @@ const currentYear = new Date().getFullYear(); } .footer-desc { - font-size: 13px; + font-size: var(--font-size-label); line-height: 1.6; color: var(--text-secondary); } @@ -152,7 +152,7 @@ const currentYear = new Date().getFullYear(); flex-wrap: wrap; gap: 6px; font-family: var(--font-mono); - font-size: 11px; + font-size: var(--font-size-meta); color: var(--text-tertiary); background-color: var(--surface-elevated); padding: 6px 10px; @@ -166,7 +166,7 @@ const currentYear = new Date().getFullYear(); } .footer-heading { - font-size: 13px; + font-size: var(--font-size-label); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; @@ -181,7 +181,7 @@ const currentYear = new Date().getFullYear(); } .footer-link { - font-size: 13px; + font-size: var(--font-size-label); color: var(--text-secondary); text-decoration: none; transition: color var(--duration-fast) ease; @@ -191,6 +191,20 @@ const currentYear = new Date().getFullYear(); color: var(--text-primary); } + /* 13px links stacked on a 10px gap give a ~16px hit area. On touch the rows + become the target instead of the text. */ + @media (max-width: 768px), (pointer: coarse) { + .footer-links { + gap: 0; + } + + .footer-link { + display: flex; + align-items: center; + min-height: 44px; + } + } + /* Bottom Bar */ .footer-bottom { display: flex; diff --git a/web/src/components/Header.astro b/web/src/components/Header.astro index 4c2630a..54fe4c9 100644 --- a/web/src/components/Header.astro +++ b/web/src/components/Header.astro @@ -41,69 +41,75 @@ const viUrl = `${basePath || ''}/vi`; - - - - -
- - + +
@@ -133,6 +139,7 @@ const viUrl = `${basePath || ''}/vi`; const open = () => { nav.classList.add('is-open'); toggle.setAttribute('aria-expanded', 'true'); + (nav.querySelector('.nav-link'))?.focus(); }; toggle.addEventListener('click', () => { @@ -143,11 +150,25 @@ const viUrl = `${basePath || ''}/vi`; nav.querySelectorAll('a').forEach((link) => link.addEventListener('click', close)); document.addEventListener('keydown', (event) => { - if (event.key === 'Escape') close(); + if (event.key === 'Escape' && nav.classList.contains('is-open')) { + close(); + toggle.focus(); + } }); - // Leaving the mobile breakpoint must not strand the panel in an open state. - window.matchMedia('(min-width: 769px)').addEventListener('change', close); + // A drawer with no scrim still has to close when the page is clicked elsewhere. + document.addEventListener('click', (event) => { + if (!nav.classList.contains('is-open')) return; + const target = event.target as Node | null; + if (target && !nav.contains(target) && !toggle.contains(target)) close(); + }); + + // Leaving the drawer breakpoint must not strand the panel in an open state. + // Same condition as the @media block that renders the drawer. + const drawer = window.matchMedia('(max-width: 860px), (pointer: coarse) and (max-width: 900px)'); + drawer.addEventListener('change', (event) => { + if (!event.matches) close(); + }); } if (document.readyState === 'loading') { @@ -188,7 +209,9 @@ const viUrl = `${basePath || ''}/vi`; display: flex; align-items: center; justify-content: space-between; - height: 60px; + /* min-height, not height: Vietnamese labels wrap to 3 lines on a coarse + pointer at 769px and painted 7.6px outside the sticky bar. */ + min-height: var(--site-header-height, 60px); gap: 16px; } @@ -228,11 +251,24 @@ const viUrl = `${basePath || ''}/vi`; color: var(--text-primary); } - /* Navigation Links */ - .header-nav { + /* Navigation */ + .header-menu { display: flex; align-items: center; + justify-content: space-between; gap: 24px; + flex: 1; + min-width: 0; + } + + .nav-links { + display: flex; + align-items: center; + gap: 24px; + + /* Auto margins, not space-between: they recenter the links in the leftover + space exactly as the old three-child header-inner did. */ + margin-inline: auto; } .nav-link { @@ -273,13 +309,13 @@ const viUrl = `${basePath || ''}/vi`; align-items: center; justify-content: center; font-family: var(--font-mono); - font-size: 11px; + font-size: var(--font-size-xs); font-weight: 500; color: var(--text-tertiary); text-decoration: none; padding: 3px 7px; border-radius: var(--radius-full); - transition: all var(--duration-fast) ease; + transition: color var(--duration-fast) ease, background var(--duration-fast) ease, box-shadow var(--duration-fast) ease; user-select: none; } @@ -295,8 +331,10 @@ const viUrl = `${basePath || ''}/vi`; } .lang-divider { - color: var(--border-color); - font-size: 10px; + /* var(--border-color) rendered this at 1.22:1 - invisible text that a + screen reader can still announce. */ + color: var(--text-tertiary); + font-size: var(--font-size-meta); user-select: none; line-height: 1; } @@ -304,7 +342,7 @@ const viUrl = `${basePath || ''}/vi`; .github-btn { height: 36px; padding: 0 14px; - font-size: 13px; + font-size: var(--font-size-label); } .github-icon { @@ -315,16 +353,50 @@ const viUrl = `${basePath || ''}/vi`; display: none; } - /* Responsive styling */ - @media (max-width: 768px) { + /* + Two separate concerns. Tap sizing keys off the input device, not the width: + a 1024px tablet in landscape is still a thumb. The drawer reflow below keys + off the viewport. + */ + @media (max-width: 768px), (pointer: coarse) { + .nav-toggle { + width: 44px; + height: 44px; + padding: 12px; + } + + .lang-switcher { + height: 48px; + padding: 2px 6px; + } + + .lang-btn { + height: 44px; + padding: 0 14px; + font-size: var(--font-size-label); + } + + .lang-divider { + font-size: var(--font-size-label); + } + + .github-btn { + height: 44px; + padding: 0 16px; + font-size: 14px; + } + } + + /* Drawer. Content-driven, not device-driven: with touch-sized controls the + row needs 886px (brand 178 + links 339 + actions 281 + gaps 88), so a + 820px tablet cannot hold it and Vietnamese labels wrap to two lines. */ + @media (max-width: 860px), (pointer: coarse) and (max-width: 900px) { .nav-toggle { display: inline-flex; flex-direction: column; justify-content: center; gap: 4px; - width: 36px; - height: 36px; - padding: 8px; + flex-shrink: 0; border: 1px solid var(--border-color); border-radius: var(--radius-sm); background: transparent; @@ -351,7 +423,7 @@ const viUrl = `${basePath || ''}/vi`; transform: translateY(-5.5px) rotate(-45deg); } - .header-nav { + .header-menu { position: absolute; top: 100%; left: 0; @@ -359,37 +431,50 @@ const viUrl = `${basePath || ''}/vi`; display: none; flex-direction: column; align-items: stretch; - gap: 2px; - padding: 10px 20px 14px; + gap: 0; + max-height: calc(100dvh - 60px); + overflow-y: auto; + padding: 8px 20px 16px; border-bottom: 1px solid var(--border-color); background-color: var(--surface-elevated); } - :global([data-theme="dark"]) .header-nav, - :global(:root:not([data-theme="light"])) .header-nav { + :global([data-theme="dark"]) .header-menu, + :global(:root:not([data-theme="light"])) .header-menu { background-color: #09090b; } - .header-nav.is-open { + .header-menu.is-open { display: flex; } - .github-label { - display: none; + .nav-links { + flex-direction: column; + align-items: stretch; + gap: 0; + margin: 0; } - .github-btn { - padding: 0 10px; + .nav-link { + display: flex; + align-items: center; + min-height: 44px; + padding: 0 2px; + font-size: 16px; + border-bottom: 1px solid var(--border-color); } - .lang-switcher { - padding: 1px 3px; - height: 28px; + .nav-link:last-child { + border-bottom: none; } - .lang-btn { - padding: 2px 5px; - font-size: 10px; + .header-actions { + justify-content: space-between; + width: 100%; + gap: 12px; + margin-top: 14px; + padding-top: 14px; + border-top: 1px solid var(--border-color); } } diff --git a/web/src/components/ThemeToggle.astro b/web/src/components/ThemeToggle.astro index b4917e2..267f4b5 100644 --- a/web/src/components/ThemeToggle.astro +++ b/web/src/components/ThemeToggle.astro @@ -86,6 +86,13 @@ const t = getI18n(lang); transform: scale(0.95); } + @media (max-width: 768px), (pointer: coarse) { + .theme-toggle-btn { + width: 44px; + height: 44px; + } + } + .theme-icon { transition: transform var(--duration-fast) var(--ease-spring), opacity var(--duration-fast) ease; } From 07f865d1b6fadd884ffca3f60a32729cec30d3eb Mon Sep 17 00:00:00 2001 From: ahauy Date: Fri, 6 Nov 2026 12:23:08 +0700 Subject: [PATCH 2/4] fix(web): keep the installer and shortcut tab strips inside the viewport --- web/src/styles/shortcut-matrix.css | 45 +++++++-- web/src/styles/unified-installer.css | 132 +++++++++++++++++++++++---- 2 files changed, 151 insertions(+), 26 deletions(-) diff --git a/web/src/styles/shortcut-matrix.css b/web/src/styles/shortcut-matrix.css index 273ef32..075e859 100644 --- a/web/src/styles/shortcut-matrix.css +++ b/web/src/styles/shortcut-matrix.css @@ -23,9 +23,22 @@ border: 1px solid var(--color-border, #e4e4e7); border-radius: var(--radius-full, 9999px); overflow-x: auto; + + /* Flex items floor at min-content, which is what made the 5-tab strip 556px + (EN) / 596px (VI) wide and forced the whole page sideways. Without this the + overflow-x above can never engage. */ + min-width: 0; + max-width: 100%; + overscroll-behavior-x: contain; + scrollbar-width: none; +} + +.category-tabs::-webkit-scrollbar { + display: none; } .cat-tab-btn { + flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; @@ -38,7 +51,7 @@ font-weight: 500; color: var(--color-text-secondary, #52525b); cursor: pointer; - transition: all var(--transition-fast, 150ms ease); + transition: background 150ms ease, color 150ms ease, border-color 150ms ease, box-shadow 150ms ease; white-space: nowrap; } @@ -62,7 +75,7 @@ min-width: 18px; height: 18px; padding: 0 5px; - font-size: 11px; + font-size: var(--font-size-meta); font-weight: 600; border-radius: var(--radius-full, 9999px); background: rgba(113, 113, 122, 0.14); @@ -79,7 +92,7 @@ display: flex; align-items: center; position: relative; - min-width: 320px; + min-width: min(320px, 100%); flex: 1; max-width: 480px; } @@ -182,7 +195,7 @@ .shortcut-action { font-family: var(--font-display); - font-size: var(--font-size-base, 16px); + font-size: var(--font-size-lg, 18px); font-weight: 600; color: var(--color-text-primary, #09090b); margin: 0; @@ -190,7 +203,7 @@ .shortcut-badge { font-family: var(--font-display); - font-size: 11px; + font-size: var(--font-size-meta); font-weight: 600; color: var(--brand-apple-blue-vibrant, #0071e3); background: rgba(10, 132, 255, 0.1); @@ -261,7 +274,7 @@ font-weight: 500; color: var(--color-text-secondary, #52525b); cursor: pointer; - transition: all var(--transition-fast, 150ms ease); + transition: background 150ms ease, color 150ms ease, border-color 150ms ease; } .copy-shortcut-btn:hover { @@ -302,14 +315,14 @@ gap: 8px; height: 40px; padding: 0 20px; - font-size: 13px; + font-size: var(--font-size-label); font-weight: 600; cursor: pointer; border-radius: var(--radius-full); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-primary); - transition: all var(--transition-fast); + transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast); } .expand-toggle-btn:hover { @@ -382,7 +395,7 @@ font-weight: 600; color: var(--brand-apple-blue-vibrant); cursor: pointer; - transition: all var(--transition-fast); + transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast); } .reset-filter-btn:hover { @@ -390,6 +403,20 @@ border-color: var(--brand-apple-blue); } +/* Touch sizing for the matrix controls. Vertical only: widening the category + tabs would push the tab strip further off-screen on a phone. */ +@media (max-width: 768px), (pointer: coarse) { + .cat-tab-btn, + .copy-shortcut-btn, + .reset-filter-btn { + min-height: 44px; + } + + .expand-toggle-btn { + height: 44px; + } +} + /* Responsive Breakpoints */ @media (max-width: 900px) { .shortcuts-grid { diff --git a/web/src/styles/unified-installer.css b/web/src/styles/unified-installer.css index 571ff92..a7e0ee4 100644 --- a/web/src/styles/unified-installer.css +++ b/web/src/styles/unified-installer.css @@ -43,6 +43,11 @@ align-items: center; gap: 16px; flex: 1; + + /* Without this the segmented control's 314px min-content propagates up + through brand-text and badge-row, and the whole identity block measures + 356px inside a 246px card at 320px viewport. */ + min-width: 0; } .app-icon-squircle { @@ -61,6 +66,7 @@ flex-direction: column; gap: 6px; flex: 1; + min-width: 0; } .badge-row { @@ -68,6 +74,7 @@ align-items: center; gap: 10px; flex-wrap: wrap; + min-width: 0; } .version-badge { @@ -79,7 +86,7 @@ background: rgba(48, 209, 88, 0.12); border: 1px solid rgba(48, 209, 88, 0.3); color: var(--color-success); - font-size: 11px; + font-size: var(--font-size-meta); font-weight: 600; font-family: var(--font-mono); } @@ -99,7 +106,7 @@ } .release-date { - font-size: 11px; + font-size: var(--font-size-meta); color: var(--color-text-tertiary); } @@ -113,6 +120,19 @@ border-radius: var(--radius-full); border: 1px solid var(--color-border); margin-left: 4px; + + /* Three tabs measure 319px, which at 320px viewport spilled out of the + column-stacked card header and pushed the whole document sideways. Same + treatment as the shortcut tab strip: constrain, then scroll internally. */ + min-width: 0; + max-width: 100%; + overflow-x: auto; + overscroll-behavior-x: contain; + scrollbar-width: none; +} + +.installer-tabs::-webkit-scrollbar { + display: none; } .installer-tab { @@ -120,10 +140,13 @@ align-items: center; gap: 5px; padding: 3px 12px; + flex-shrink: 0; border: none; background: transparent; color: var(--color-text-tertiary); - font-size: 11px; + /* 12px, not 11: the touch override below raises this to 13px, and the + install-method switcher must never be smallest on desktop. */ + font-size: var(--font-size-xs); font-weight: 500; border-radius: var(--radius-full); cursor: pointer; @@ -146,8 +169,18 @@ box-shadow: 0 1px 4px rgba(0, 0, 0, 0.16); } +/* The install-method switcher is the page's most consequential control, and a + 19px pill cannot be hit with a thumb. Height only; width is untouched so the + tab strip's overflow behaviour stays as it was measured. */ +@media (max-width: 768px), (pointer: coarse) { + .installer-tab { + min-height: 44px; + font-size: var(--font-size-label); + } +} + .license-tag { - font-size: 11px; + font-size: var(--font-size-meta); color: var(--color-text-tertiary); font-family: var(--font-mono); padding: 3px 8px; @@ -168,10 +201,12 @@ } .installer-desc { - font-size: var(--font-xs); + font-size: var(--font-size-body-sm); color: var(--color-text-secondary); line-height: 1.55; margin: 0; + min-width: 0; + max-width: 34em; min-height: 38px; } @@ -255,7 +290,7 @@ } .btn-specs { - font-size: 11px; + font-size: var(--font-size-meta); opacity: 0.8; font-family: var(--font-mono); } @@ -305,7 +340,7 @@ color: #30d158; font-family: var(--font-mono); font-weight: 700; - font-size: 13px; + font-size: var(--font-size-label); user-select: none; flex-shrink: 0; } @@ -338,7 +373,7 @@ background: rgba(255, 255, 255, 0.12); border: 1px solid rgba(255, 255, 255, 0.16); color: #f4f4f5; - font-size: 11px; + font-size: var(--font-size-meta); font-weight: 600; cursor: pointer; flex-shrink: 0; @@ -390,12 +425,14 @@ border-radius: var(--radius-sm); background: var(--color-surface-elevated); border: 1px solid var(--color-border); - font-size: 11px; + font-size: var(--font-size-meta); color: var(--color-text-secondary); font-family: var(--font-mono); - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; + /* "Universal Binary (Apple Silicon & Intel)" lost its tail at 320px, which + removed the claim rather than trimming it. */ + white-space: normal; + overflow-wrap: anywhere; + text-align: center; } .spec-icon { @@ -410,7 +447,7 @@ justify-content: space-between; padding-top: 18px; border-top: 1px solid var(--color-border); - font-size: 11px; + font-size: var(--font-size-meta); } .checksum-hint { @@ -433,11 +470,57 @@ } .checksum-value { - font-size: var(--font-xs, 12px); - color: var(--color-text-tertiary); - overflow: hidden; - text-overflow: ellipsis; + font-family: var(--font-mono); + font-variant-numeric: tabular-nums; + font-size: var(--font-size-xs); + + /* The digest is now the full 64 characters and load-bearing, so it wraps + instead of ellipsising and sits at AA contrast instead of 3.87:1. */ + color: var(--color-text-secondary); max-width: 100%; + white-space: normal; + overflow-wrap: anywhere; + user-select: all; + cursor: text; +} + +/* Read-before-you-run affordance under the terminal command. The stack keeps + .action-panel a single-child flex row, which it was designed as. */ +.terminal-stack { + display: flex; + flex-direction: column; + align-items: stretch; + gap: 10px; + width: 100%; + min-width: 0; +} + +.script-check-row { + display: flex; + align-items: center; + gap: 8px; + margin: 0; + font-size: var(--font-sm, 14px); + color: var(--color-text-secondary); +} + +.script-check-icon { + flex-shrink: 0; + color: var(--color-warning); +} + +.script-check-link { + display: inline-flex; + align-items: center; + min-height: 44px; + color: var(--brand-apple-blue); + text-decoration: underline; + text-underline-offset: 3px; + text-decoration-color: rgba(10, 132, 255, 0.4); +} + +.script-check-link:hover { + text-decoration-color: currentColor; } .releases-link { @@ -473,9 +556,24 @@ .card-header { flex-direction: column; + align-items: stretch; gap: 12px; } + /* The base rule's align-items:flex-start let the brand block size to its + 319px max-content here, so the tab pill sat on the same line as the version + badge and reached 356px. Stretch plus a full-width pill makes the badge row + wrap and the pill scroll inside the card. */ + .installer-tabs { + width: 100%; + margin-left: 0; + + /* flex-basis:100% forces the pill onto its own line inside the wrapping + badge row; without it min-width:0 let it shrink to 180px beside the + version badge and cut the tab labels mid-word. */ + flex: 1 0 100%; + } + .license-tag { align-self: flex-start; } From 1a62c74de7185fb603d57297dc1e6459dc2d8f66 Mon Sep 17 00:00:00 2001 From: ahauy Date: Fri, 6 Nov 2026 12:23:09 +0700 Subject: [PATCH 3/4] feat(web): verify the install path and put right-click Open first --- docs/features/web-distribution-hub/README.md | 10 +- docs/user-guides/web-distribution-hub.md | 16 +-- web/src/components/DistributionHub.astro | 2 +- web/src/components/GatekeeperGuide.astro | 138 +++++++++++++------ web/src/components/UnifiedInstaller.astro | 103 ++++++++------ web/src/data/distribution-data.ts | 14 +- web/src/i18n/en.json | 25 ++-- web/src/i18n/vi.json | 25 ++-- web/tests/distribution-hub.test.mjs | 6 +- 9 files changed, 204 insertions(+), 135 deletions(-) diff --git a/docs/features/web-distribution-hub/README.md b/docs/features/web-distribution-hub/README.md index fbd4296..584c9cc 100644 --- a/docs/features/web-distribution-hub/README.md +++ b/docs/features/web-distribution-hub/README.md @@ -30,8 +30,11 @@ 3. **Simulated macOS Terminal One-Line Installer (`TerminalInstaller.astro`)**: - Realistic macOS Terminal window chrome with 3 colored window control dots (red, yellow, green). - Dynamic tab toggle for developer preferences: - - **Tab 1 (`cURL`)**: `curl -fsSL https://raw.githubusercontent.com/ahauy/FlowSnap/main/install.sh | bash` - - **Tab 2 (`Homebrew`)**: `brew install --cask ahauy/tap/flowsnap` + - **Tab (`cURL`)**: `/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/ahauy/FlowSnap/main/scripts/install.sh)"` + - **Homebrew is not shipped**: the `ahauy/homebrew-tap` repository does not exist, so advertising + `brew install --cask ahauy/tap/flowsnap` would hand visitors a command that 404s. + - The component rendered on the live page is `UnifiedInstaller.astro`; this `TerminalInstaller.astro` + is not imported by any page (see the orphan cleanup backlog). - Accessible 1-click Copy button with dual fallback (`navigator.clipboard` -> temporary off-screen `