Skip to content

fix(ui): lift muted text and small tap targets to AA and 44pt - #1332

Merged
huichen merged 2 commits into
mainfrom
dev-huichen
Oct 24, 2026
Merged

huichen merged 2 commits into
mainfrom
dev-huichen

Conversation

@huichen

@huichen huichen commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

用截图 harness 逐屏审查桌面端与移动端的样式,按可度量的证据修复对比度与触控面积问题。全部改动都是在加严测试,没有为通过门禁而放宽任何断言。

桌面端

D1 ink-muted 在抬高面上的对比度不足。 palettes.json 里 9 个值重算,globals.css 的 @theme 镜像同步(说明生成器真跑过,不是只改源数据)。palettes.test.ts 的 FLOORS 新增两条底线——ink-muted 对 surface-subtle 与对 canvas 都要求 3:1;原来只测 surface,而 rail 的视图切换、chip、计数恰恰画在抬高面上,实测在每种浅色主题里都只有 2.77:1。

D2 RailViewSwitch 未选中段由 text-ink-muted 改为 text-ink-soft hover:text-ink(muted 在那个底色上只够 3:1)。
D3 ReplyProcess 折叠行容器用 text-ink-soft,计数不再覆写回 muted。
D4 禁用态主按钮改 disabled:bg-accent-fill-disabled disabled:text-accent-fill-hover。
D5 SkillRecommendCard 标题用 text-accent,注释记下旧值 1.80:1。

移动端

M1 次要文字颜色抬高到 AA;M2/M3 触控面积从 26px / 36px 统一到 44px(layout.touchTarget),单测改为由该常量推导 hitSlop,不再是硬编码 8。

这两项没有视觉差异图,也没有造一张:react-native-web 不实现 hitSlop(用 elementFromPoint 实测:28×44 的按钮有效命中区仍是 28×44),所以 before-chat / after-chat 除 M1 的颜色变化外像素一致。证据是渲染盒 + slop 算术 + 单测断言,真实效果只能在 iOS/Android 上看。

截图 harness

scripts/screenshots/scenarios.d/*.json 按平台并入 scenarios.json,两个 worker 同时给不同平台加场景不再互相覆盖。附离线测试 scripts/tests/test-screenshot-scenario-fragments.py(95 行,已接进 make test-screenshot-harness),中英文指南都补了说明。

验证

  • 桌面:npx tsc --noEmit 干净;vitest 152 文件 / 2273 测试通过;改动文件 eslint 干净。
  • 移动:npx tsc --noEmit 干净;jest 84 测试通过(含 M2/M3 的 hitSlop 断言)。
  • 截图证据:.screenshots/(gitignore 内)——桌面 15 组 before-* / after-* / diff-*、移动 6 组;两份 report.md 各有一节对比图清单。

已知未修(非本次范围,需产品决策)

accent / danger 在各自的 -soft 面上共 31 对低于 4.5(最大差 0.36),因此 remote、settings-themes 两个 audit 场景仍以 EXIT=1 收尾。这是设计决策项:要让它们达标就得改 -soft 面的饱和度或文字色阶,属于视觉方向调整,不是缺陷修复。断言保持原样,没有为了让 CI 变绿而放宽。

一处诚实说明

差异图上少量区域是截图噪声而非样式改动:rail-tree 那张含「3分钟前 → 2分钟前」这类相对时间戳,两次截图之间自然变化;视觉模型读图时还会把红/蓝标注框误认成界面配色变化。看差异面板时以成片区域为准。

Desktop: `ink-muted` was only checked against `surface`, so the same ink on
`surface-subtle` measured 2.77:1 in 9 of 28 palette renditions. Two controls
painted a label in it (the rail's view switch, the reply's process fold), a
third used the focus ring as body ink (the skill card title, 1.80:1), and a
disabled primary drew white on `#bfdbfe` at 1.42:1. The contrast floors now
cover `surface-subtle` and `canvas` so the token cannot drift back, and the
regenerated `[data-palette]` rules carry the nine new values.

Mobile: `lightColors.inkMuted` sat at 3.69-4.22:1 on every surface it is
painted on - timestamps, counts, hints and section captions. The attachment
chip reached only 26px and the step rows 36px, both short of the 44pt
`layout.touchTarget` their neighbours already keep.

Verified: desktop tsc + eslint clean, 152 vitest files / 2273 tests pass;
mobile tsc + eslint clean, 53 jest suites / 736 tests plus the two new
hitSlop assertions pass.
Two sessions adding scenarios for different platforms edited the same
`scenarios.json` and overwrote each other's work. A fragment under
`scripts/screenshots/scenarios.d/` now adds to its own platform's table (and
may override an entry of the same name); a wrong platform name or a fragment
that is not a mapping is an error rather than a silently empty capture.

The merge rules are pinned offline by `scripts/tests/test-screenshot-scenario-
fragments.py`, which `make test-screenshot-harness` runs with the two existing
harness tests. Audit fragments stay untracked: one that asserts a measurement
would make a plain `capture-*` fail on whatever it asserts.
@huichen
huichen merged commit 31a2950 into main Oct 24, 2026
12 checks passed
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.

1 participant