Repository navigation
Commit 6dda0ce
fix(console): dashboards meet the 44 px touch-target floor at phone width (#29149)
<!-- claude-projects-attribution: {"github_login":"zhuangjianguo"} -->
_Requested by **Steedos** · [project
thread](https://claude.ai/code/project/chan_018ETKaNwMZCNRYD7D8Q9Ubb?thread=cmsg_018ETKaNwMZCNRYD7D8Q9Ubb9VAiRmdySQ7HJiMeXjuBmG)_
Fixes #29078
Part of #29040 (the Dashboards flow; the other seven flows have their
own cards).
Clause-②: no
Metadata-protocol: none
## 维护者速读
- 改了什么:手机宽度(小于 `sm`,即 640 px)下,仪表盘页面的可点控件统一放大到 44 px 触控目标:页头「Refresh
All」、筛选栏的日期/下拉/文本控件与「Reset」、下拉选项行、自定义日期日历(手机上只显示一个月,日期格 44
px)、数据表的排序按钮与可钻取行、透视表的可钻取单元格、「Export
CSV」(手机上移到表格上方单独一行,不再压住最后一列的排序按钮)、钻取抽屉的「Open in list」,以及所有 Sheet
抽屉的关闭按钮。桌面宽度(`sm` 及以上)样式不变。
- 为什么改:#29040 要求移动端(WebView 内嵌 Console)逐流程审计。在真实 Console 上以 375 与 390 px
跑 CRM 和 showcase 的 4 个仪表盘:无横向滚动、弹层全部在视口内、4 倍 CPU 降速下滚动顺畅,唯独触控目标不达标,控件高
16 到 36 px。
- 风险与回滚:只改 className,不动属性、数据或协议;唯一共享组件改动是 `sheet.tsx` 的关闭按钮,只加 `max-sm:`
前缀类,桌面不变,手机上所有抽屉的关闭按钮变成 44 px;该文件由 shadcn 同步生成,改动已登记为本地补丁,同步时自动重放。回滚即还原本
PR。
- 先看:`ui/packages/components/src/ui/sheet.tsx` 与
`ui/scripts/shadcn-local-patches.mjs`(全局抽屉关闭按钮,作为 shadcn
本地补丁声明)、`ui/packages/plugin-dashboard/src/DatasetWidget.tsx`(Export CSV
手机上改为独立一行)、`ui/packages/plugin-dashboard/src/DashboardFilterBar.tsx`(日历手机上单月)。
- 两分钟验证:`cd ui && pnpm exec vitest run
packages/plugin-dashboard/src/__tests__/DashboardPhoneTouchTargets-29078.test.tsx
packages/components/src/__tests__/sheet-close-touch-target-29078.test.tsx
packages/app-shell/src/views/DashboardView.phoneTouchTarget-29078.test.tsx`,预期
3 个文件 10 个用例全绿。
- 需要你做的:无,席位落地。
## What changes
Every change is phone-only: a class under `max-sm:`, or a `min-h-11`
floor released by `sm:min-h-0` (the pattern the form select trigger
already uses). From `sm` up the class lists draw what they drew before.
- **`@object-ui/app-shell`, `DashboardView.tsx`:** the page header's
Refresh All gets the 44 px floor.
- **`@object-ui/plugin-dashboard`, `DashboardFilterBar.tsx`:** the
date-range and select triggers, the text filter, Reset, and every option
row of both lists get the floor. The custom-range calendar opens one
month below `md` (`useIsMobile`) with 44 px day cells
(`max-md:[--cell-size:2.75rem]`); two stacked months at that size would
run past a phone's viewport. From `md` up it keeps two months at 32 px.
- **`@object-ui/plugin-dashboard`, `DatasetWidget.tsx`:** the table's
sort buttons get the floor; the cells of a drillable row are 44 px tall
(a table nobody can drill is unchanged); a drillable pivot cell is 44 by
44. Export CSV is 44 px and, below `sm`, leaves the table's top-right
corner (where it would cover the last column's sort button) for its own
right-aligned row above the table.
- **`@object-ui/plugin-dashboard`, `OpenInListButton.tsx`:** the drill
drawer's Open in list gets the floor; a host `className` still merges.
- **`@object-ui/components`, `sheet.tsx`:** the Close button every Sheet
draws is a 44 px box below `sm`, its 16 px glyph where it was. The
Dialog close button is not touched.
- **`ui/scripts/shadcn-local-patches.mjs`:** `src/ui/**` regenerates
from the shadcn registry, so the Sheet edit is declared as the local
patch `sheet-close-phone-touch-target` (one anchor, written from the
vendored `sheet.registry.txt` bytes) and re-applied by the sync. Without
it the next `shadcn:update` would revert it silently;
`shadcn-local-patches.test.ts` caught the undeclared edit.
## Why
The card asks for the Dashboards flow driven at 375×812 and 390×844
against the showcase and CRM examples, five checks each. The audit ran
first on `origin/main` `6b3ba82c`, on a real Console, and only the
touch-target check failed. Claim 6571438083 declared the audit
read-only; the seat then amended the surface to these five files, their
tests and a changeset (amendment 6571555427) before any push, and added
`ui/scripts/shadcn-local-patches.mjs` and its tests (amendment
6572329768) once the derived gates showed the Sheet edit had to be
declared there.
### Run record
Harness: `pnpm build` + `pnpm console:build`, the Console served at
`/_console` by `pnpm dev:crm -- --fresh` and `pnpm dev:showcase --
--fresh`, Playwright Chromium with `isMobile`, `hasTouch`, an Android UA
and DPR 2. Pages: CRM `pipeline_dashboard` (KPIs, line, bar, pie);
showcase `showcase_ops_dashboard` (date and select filters, KPIs,
charts, table), `showcase_revenue_pulse` (date and region filters, KPIs,
charts, table), `showcase_chart_gallery` (every chart type, table,
pivot). Before and after screenshots and the raw reports stay in the
project folder.
| Check | 375×812 before | 375×812 after | 390×844 before | 390×844
after | Evidence |
|---|---|---|---|---|---|
| No horizontal page scroll | PASS | PASS | PASS | PASS | page overflow
0 on all 4 dashboards, no element past the right edge. Tables and the
pivot scroll sideways inside their own card, not the page. |
| Touch targets ≥ 44 px | FAIL | PASS | FAIL | PASS | before: Refresh
All 36, filter triggers 32, option rows 32, calendar days and arrows 32,
sort buttons 16, drillable rows 25, pivot cells 25, Export CSV 22,
drawer Close 16, Open in list 36. After: 0 targets under 44 in the page,
the filter lists, the calendar and the drill drawer. |
| Dialogs and drawers fit | PASS | PASS | PASS | PASS | filter lists
inside the viewport (after: B802 of 812, B834 of 844); custom range
before two stacked months to B709, after one month T147 to B512; drill
drawer full screen. No overlay overflows sideways. |
| Virtual keyboard does not cover the focused field | N/A | N/A | N/A |
N/A | no text-entry field in the flow: the four dashboards declare only
date and select filters, the custom range is a calendar, the drill
drawer has no input. |
| Long lists responsive at CPU 4× | PASS | PASS | PASS | PASS | CDP
`setCPUThrottlingRate 4`: the dashboard scroller (up to 6.5k px)
scrolled in 30 steps with p95 frame 17 ms and 0 long tasks; tap on a
table row to drill drawer visible 507 to 749 ms, the data request
included. |
Not fixed here, and not this card's file surface: the Console app bar's
controls (sidebar toggle 28 px; home, search, Studio, inbox, account 32
px) are under 44 px on every route. They are AppHeader's, held by the
Navigation card #29075.
## Tests
- New
`ui/packages/plugin-dashboard/src/__tests__/DashboardPhoneTouchTargets-29078.test.tsx`
(8 cases): filter triggers, text field and Reset carry the floor; every
option row of both lists does; below `md` the custom range opens one
month with the 44 px cell size, and from `md` up it keeps two (control);
sort buttons and drillable-row cells carry the floor and Export CSV is
44 px out of the corner; a non-drillable table's rows do not grow
(control); a drillable pivot cell is 44 by 44; Open in list carries the
floor and keeps a host class.
- New
`ui/packages/app-shell/src/views/DashboardView.phoneTouchTarget-29078.test.tsx`
(1 case): Refresh All carries the floor.
- New
`ui/packages/components/src/__tests__/sheet-close-touch-target-29078.test.tsx`
(1 case): the Sheet Close button is 44 px below `sm`, keeps `right-4
top-4` from `sm` up and its 16 px glyph.
- Reverse verification: with the five source files checked out from
`origin/main` `6b3ba82c`, the three files ran 8 failed, 2 passed (the
two controls), then restored from `HEAD` (`git diff HEAD` empty). These
tests import the components from source, so no build stands between the
edit and the run.
- `ui/scripts/__tests__/shadcn-local-patches.test.ts` was red on
`0ff4d360` (1 case, "sheet: byte round-trip holds": `sheet.tsx` no
longer regenerated from registry bytes) and is green on `8423b760` with
the patch declared.
- On `0ff4d360`: the whole `packages/plugin-dashboard/` suite, 200
files, 1922 passed, 6 skipped; the 43 components, app-shell and console
test files naming `sheet` or the touched dashboard modules, 404 passed;
`turbo run type-check` for components, plugin-dashboard and app-shell,
67 of 67 tasks.
## Acceptance notes
- Chart segments are drill targets sized by the data (bars 39 to 56 px
wide, some gallery bars 30 px tall). They are not controls this PR
resizes.
- The drill drawer lists held 2 to 4 seed rows, so a long drawer list
was not exercised at 4× CPU; the dashboard scroller itself (6.5k px)
was.
- No Playwright spec is added; the card welcomes one where a fix lands
but does not require it for this flow. The audit harness and its reports
are in the project folder.
## Verification
<details><summary>Derived gates, local subset</summary>
`node scripts/pm/dispatch-gates.mjs --commands` derived 36 families. On
`0ff4d360` all 36 ran: 35 exit 0 (among them `check-sdui-manifest.mjs`
and its self-test, `check-changeset-no-major`, `check-empty-changeset`,
`check-adr-0087-registration`, `check:nul-bytes`,
`check:cross-package-test-inputs`, `check:test-source-alias`,
`check:query-options-erasure`, and `check:type-check-debt` under the
verify lock), and `pnpm --dir ui exec vitest run scripts/` exit 1 on the
one shadcn round-trip case above. `dispatch-gates --ran`: 36 derived, 36
run, 0 NOT-MEASURED. On `8423b760` the same derivation (identical list):
`pnpm --dir ui exec vitest run scripts/` exit 0, 169 files passed, 2
skipped (4900 tests). The other 35 are re-running on `8423b760`; their
results go in the os-dev report on the card.
</details>
Families CI runs (Lint UI, Test UI, Type Check UI and the rest) are read
from this PR's check-runs.
## Human Minimum
- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(Not touched.)
- [x] 2. Every name I added uses the casing for its kind.
- [ ] 3. No formatter ran; `pnpm lint` passes. (No formatter ran; `pnpm
lint` is CI's Lint UI run.)
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: not touched.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English, except the 维护者速读 block
the lane requires.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01QsR2jTE9T9iArKPf81eTtb
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent fa31010 commit 6dda0ce
10 files changed
Lines changed: 420 additions & 18 deletions
File tree
- .changeset
- ui
- packages
- app-shell/src/views
- components/src
- __tests__
- ui
- plugin-dashboard/src
- __tests__
- scripts
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
337 | 337 | | |
338 | 338 | | |
339 | 339 | | |
| 340 | + | |
| 341 | + | |
340 | 342 | | |
341 | 343 | | |
342 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| |||
100 | 101 | | |
101 | 102 | | |
102 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
| |||
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
232 | 243 | | |
233 | 244 | | |
234 | 245 | | |
| |||
263 | 274 | | |
264 | 275 | | |
265 | 276 | | |
266 | | - | |
| 277 | + | |
267 | 278 | | |
268 | 279 | | |
269 | 280 | | |
270 | 281 | | |
271 | 282 | | |
272 | 283 | | |
273 | | - | |
| 284 | + | |
274 | 285 | | |
275 | | - | |
| 286 | + | |
276 | 287 | | |
277 | 288 | | |
278 | | - | |
| 289 | + | |
279 | 290 | | |
280 | 291 | | |
281 | 292 | | |
| |||
288 | 299 | | |
289 | 300 | | |
290 | 301 | | |
291 | | - | |
| 302 | + | |
| 303 | + | |
292 | 304 | | |
293 | 305 | | |
294 | 306 | | |
| |||
529 | 541 | | |
530 | 542 | | |
531 | 543 | | |
532 | | - | |
| 544 | + | |
533 | 545 | | |
534 | 546 | | |
535 | 547 | | |
536 | | - | |
| 548 | + | |
537 | 549 | | |
538 | | - | |
| 550 | + | |
539 | 551 | | |
540 | 552 | | |
541 | 553 | | |
| |||
553 | 565 | | |
554 | 566 | | |
555 | 567 | | |
556 | | - | |
| 568 | + | |
557 | 569 | | |
558 | 570 | | |
559 | 571 | | |
| |||
600 | 612 | | |
601 | 613 | | |
602 | 614 | | |
603 | | - | |
| 615 | + | |
604 | 616 | | |
605 | 617 | | |
606 | 618 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1504 | 1504 | | |
1505 | 1505 | | |
1506 | 1506 | | |
1507 | | - | |
| 1507 | + | |
| 1508 | + | |
| 1509 | + | |
| 1510 | + | |
| 1511 | + | |
1508 | 1512 | | |
1509 | 1513 | | |
1510 | 1514 | | |
| |||
1648 | 1652 | | |
1649 | 1653 | | |
1650 | 1654 | | |
1651 | | - | |
| 1655 | + | |
| 1656 | + | |
1652 | 1657 | | |
1653 | 1658 | | |
1654 | 1659 | | |
| |||
1867 | 1872 | | |
1868 | 1873 | | |
1869 | 1874 | | |
| 1875 | + | |
1870 | 1876 | | |
1871 | | - | |
| 1877 | + | |
1872 | 1878 | | |
1873 | 1879 | | |
1874 | 1880 | | |
| |||
1898 | 1904 | | |
1899 | 1905 | | |
1900 | 1906 | | |
1901 | | - | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
1902 | 1910 | | |
1903 | 1911 | | |
1904 | 1912 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
| 52 | + | |
| 53 | + | |
53 | 54 | | |
54 | 55 | | |
55 | 56 | | |
| |||
0 commit comments