feat: migrate Tag, TagGroup and ErrorMessage with collection and focus contracts
Port the fixed HeroUI baseline tag/tag-group/error-message components onto the existing collection selection/registry protocols instead of a second state model. - TagGroup owns selection, disabled scope, removal requests and name/description wiring; TagGroupList renders the role=grid node and Tag renders role=row. - Removal has one path: a press inside the remove subtree is a removal request, so custom remove buttons work without a second event source; focus follows the next neighbour only after the item is actually gone. - ErrorMessage keeps the baseline slot marker and reuses the field part ids without gaining validation or aria-invalid semantics. - Ship the 12 tag-group and 2 error-message previews, both doc pages, navigation, a 35-case behavioural suite and independent tarball consumption checks.
This commit is contained in:
@@ -985,3 +985,27 @@ Button/PopoverTrigger/Link/ToggleButtonGroup 源码及几何复核后,移除
|
||||
## 2026-10-25 B01 最终验收
|
||||
|
||||
整批23项复核回归通过;集成人修正CSS.escape测试补丁边界并将相关探针加入test:unit入口。最终pnpm test为73文件/938项通过,无未捕获错误;typecheck、build:docs和diff检查通过。独立消费夹具真实浏览器确认子菜单First向上循环至Last。范围及限制见 `migrations/B01-final-acceptance.md`,不新增SSR/水合/Nuxt要求,未合main、未推送。
|
||||
|
||||
## 2026-10-25 B03 Tag / TagGroup / ErrorMessage
|
||||
|
||||
迁移与差异范围见 [B03 报告](migrations/B03-tag-error-message.md):Tag、TagGroup、TagGroupList、TagRemoveButton、ErrorMessage 五部件,TagGroup 12 例 + ErrorMessage 2 例,分支 `feat/b03-tag-error-message`(起点 `3532cc6`,未合 main、未推送)。
|
||||
|
||||
### 自动化
|
||||
|
||||
- `pnpm typecheck`:通过(vue-tsc --noEmit)。
|
||||
- `pnpm test`:**74 文件 / 973 项**通过(本批新增 `tests/tag-error-message.test.ts` 35 项,同时加入 `test:unit` 显式列表);连续两次执行结果一致。
|
||||
- `pnpm build:docs`:退出码 0;SSG 预渲染阶段曾在 `elementFromRef` 触发 `Element is not defined`,已用非浏览器环境保护修复后重跑通过。
|
||||
- `pnpm format`(prettier --check .)与 `git diff --check`:通过。
|
||||
- 独立 tarball 消费(`/private/tmp/heroui-b03-consumer`,pnpm 11.25.0 + 两份 `pnpm pack` 产物):`node consume-b03-tag-error-message.mjs` 通过(11 项导出、SSR HTML 契约、CSS 选择器);`b03-tag-error-message-contract.ts` 在 `--moduleResolution bundler` 与 `nodenext` 两种模式下通过,4 个 `@ts-expect-error` 反例均实际触发。
|
||||
|
||||
### 浏览器重点验证(127.0.0.1:5183,Chromium/IAB,浅色 + 深色)
|
||||
|
||||
- 语义:列表 `role="grid"`、`aria-label` 来自 TagGroup 的 `aria-label`,行 `role="row"`;`Label` 存在时 `aria-labelledby` 指向 Label(`span`),Description/ErrorMessage 的 id 进入 `aria-describedby`。
|
||||
- 选择:点击行后 `aria-selected/data-selected` 同步,选中态背景为 `accent-soft`(`oklab(0.6204 -0.0543052 -0.187286 / 0.2)`),单选用 `ArrowRight`/`End` 移动焦点(资讯→旅行→购物),`Space` 切换后原选中项取消。
|
||||
- 尺寸/变体:`sm` 2px 8px/12px/12px、`md` 4px 8px/12px/12px、`lg` 6px 10px/14px/16px;`surface` 背景为 `oklch(1 0 0)`,`default` 为 `oklch(0.94 0.001 286.375)`;深色下默认背景 `oklch(0.274 0.006 286.033)`、文字 `oklch(0.9911 0 0)`。
|
||||
- 禁用:`isDisabled` 与 `disabledKeys` 均输出 `aria-disabled="true"`/`data-disabled="true"`,计算透明度 0.5。
|
||||
- 移除:移除按钮 12×12,`::after` 提供 24×24 命中区;点击后该标签消失,焦点落到原位置的下一个标签(旅行被移除后落到游戏)。
|
||||
- 焦点环:键盘聚焦标签时 `:focus-visible` 与 `data-focus-visible="true"` 同时成立,`status-focused` 上屏(2px surface + 4px focus 双层 box-shadow)。
|
||||
- 文档:API 表格全部 728px = 正文宽度、`display: table`、`table-layout: fixed`、`scrollWidth === clientWidth`(长 16 行与短 4 行表均无横向溢出);侧栏顺序为 EmptyState → ErrorMessage → FieldError,TagGroup 位于 Tabs 与 TextArea 之间;ErrorMessage 页面渲染 `<p class="hv-error-message" slot="errorMessage">`。
|
||||
|
||||
未验证:逐像素对比、读屏软件、物理触屏、窄屏断点截图。截图在本轮首次采集后 IAB 合成器不再返回帧(`capture timed out`),因此尺寸/配色改为计算样式断言,未以旧截图充当本轮证据。
|
||||
|
||||
Reference in New Issue
Block a user