test: record ColorSwatchPicker review regressions and findings
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
# 当前工作区交接
|
||||
|
||||
- 任务:COLOR-SWATCH-PICKER 已实施完成(公共 ColorSwatchPicker 迁移),卡状态 implemented;未独立复核、未合 main、未 push。
|
||||
- 任务:COLOR-SWATCH-PICKER 已实施完成(公共 ColorSwatchPicker 迁移),卡状态 implemented;独立复核发现 R1–R4 四项阻断,未合 main、未 push。
|
||||
- 工作区/分支:heroui-vue / `feat/color-swatch-picker-public`。
|
||||
- 起点:`fa4146ee0b5805e388a6c241c31c69900eabeb18`(含任务卡与 README 入口的计划提交,前置 `7287318d86112159f9a9c4c4beb9bc1cdbdf1942`)。
|
||||
- 实施提交:`8d9adda8da702f0c7dabbf290ad03eb446a25570`;结果提交紧随其后。
|
||||
- 入口:`docs/tasks/COLOR-SWATCH-PICKER.md` 与 `docs/tasks/results/COLOR-SWATCH-PICKER.md`;由主会话亲自完成,未委派其他 AI,不宣称独立复核。
|
||||
- 验证:任务定向 11 文件/129 项(含新 2 文件/31 项)、typecheck、build:docs、最终 tarball 五契约(color-swatch-picker/color-swatch/color-foundation/color-picker-protocol/color-field)与真实浏览器检查通过;截图/视口缩放限制记录在结果内。
|
||||
- 预览:文档 5173 保留(cwd=apps/docs),页面 `/components/color-swatch-picker`;临时 RTL/透明/表单回归页已删除;playground 未启动。
|
||||
- 接续:合入/推送/全量集成回归需用户授权;ColorPicker 仍为私有,是剩余公共家族。
|
||||
- 接续:先按结果文件的独立复核问题表修复 R1–R4,再增量复核;原提交全量105文件/1548项及typecheck已独立通过,新增四项回归失败。ColorPicker 仍为私有,是剩余公共家族。
|
||||
|
||||
单目录串行;后续先检查实际git状态,不自动开始下一家族。
|
||||
|
||||
@@ -63,3 +63,19 @@ basic、variants、sizes、disabled、stack-layout、default-value、controlled
|
||||
|
||||
- 未做:SSR/水合/Nuxt 服务端适配、逐像素自动对比、完整读屏矩阵、真机矩阵(范围约定内不投入)。截图工具需要可见桌面窗口,本会话不可用,视觉结论以真实浏览器计算样式/几何/事件结果替代;窄屏无缩放工具,换行用 120px 约束容器(同一 flex-wrap 机制)验证;禁用项 `pointer-events:none` 使真实点击工具报不可点击(等价于用户点击穿透),键盘跳过与禁用选择另有单测。
|
||||
- 未宣称独立复核/集成:卡状态为 implemented;合入 main、推送与全量集成回归需用户后续授权(按仓库规则由集成阶段执行全量 `pnpm test`)。
|
||||
|
||||
|
||||
## 独立复核(2026-10-27,未通过)
|
||||
|
||||
复核基线:`efb53d4ce711fd8dda6bb63c4551aaac802b469e`;主会话独立检查代码、公开文档和高风险输入路径,未委派其他会话。结论:有阻断问题,保持 implemented,不合 main、不 push。下列用例追加到现有 `tests/color-swatch-picker.test.ts` 的 `ColorSwatchPicker activation lifecycle and dynamic focus` 分组,属于现有交互契约遗漏,不新增专项矩阵。
|
||||
|
||||
| 编号 / 优先级 | 问题与影响 | 复现与实际证据 | 修复要求 |
|
||||
| --- | --- | --- | --- |
|
||||
| R1 / P2 | 右键/中键按下同样选择颜色;打开菜单或辅助鼠标操作会误改值 | 原生 `mousedown(button=2)` 触发 update:modelValue,预期无事件。真实 5173 basic 页对 #D946EF 右键后该 option 变为 selected | 只允许主鼠标激活,保留取消能力,补中键反例 |
|
||||
| R2 / P1 | 动态禁用当前聚焦项后,根仍 tabindex=-1、其余项也为 -1,列表失去键盘入口 | focus 第一项→将该项 isDisabled 改 true→两次 nextTick;所有未禁用节点 tabindex=0 的数量为 0(预期 1)。根的 watch 只跟踪 ordered(),没有跟踪项 disabled | 监听实际可用集合并恢复合法入口/焦点,兼顾根禁用与重新启用、所有项禁用、焦点移除 |
|
||||
| R3 / P2 | 鼠标释放没有清理 isPressed/data-pressed | 原生主键 mousedown→同项 mouseup→nextTick,data-pressed 仍为 true(预期移除);只在 mouseleave、blur 或 keyup 等其他路径清理 | 完整处理释放/取消/失焦/禁用生命周期,作用域插槽与 DOM 状态一致 |
|
||||
| R4 / P2 | 仅发送 click 的辅助技术激活无法选色 | 对未选 option 分发可取消的 `click(detail=0)`,aria-selected 仍为 false;代码只监听 mousedown、没有 click 路径 | 提供 click-only 激活路径,避免正常鼠标或键盘的兼容 click 重复提案;保留 preventDefault、禁用及受控拒绝/重试语义 |
|
||||
|
||||
独立验证:原提交 `pnpm test` 全量 105 文件/1548 项通过;`pnpm typecheck` 通过。新增四项回归按上述正确期望均失败,未删除/降低断言;定向命令:`pnpm exec vitest run tests/color-swatch-picker.test.ts -t 'activation lifecycle and dynamic focus'`。筛选运行中其他用例由 Vitest 标记为未选择,不是源码新增 skip。
|
||||
|
||||
本轮未重跑 build:docs/tarball:已有明确交互阻断,先修同一问题表,再验证修复影响范围与产物。上一节的构建/产物通过仍为实施方证据,不称本轮独立通过。没有执行合并或推送;任务原有实现提交保持原样,本轮只增加回归与复核记录。
|
||||
|
||||
@@ -778,3 +778,42 @@ describe("ColorSwatchPicker owner composition", () => {
|
||||
expect(items(w)[2]!.attributes("aria-selected")).toBe("true");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
describe("ColorSwatchPicker activation lifecycle and dynamic focus", () => {
|
||||
it("ignores secondary mouse buttons", async () => {
|
||||
const w = picker();
|
||||
items(w)[1]!.element.dispatchEvent(new MouseEvent("mousedown", { bubbles: true, cancelable: true, button: 2 }));
|
||||
await w.vm.$nextTick();
|
||||
expect(w.getComponent(ColorSwatchPicker).emitted("update:modelValue")).toBeUndefined();
|
||||
});
|
||||
it("clears pressed state after the primary mouse release", async () => {
|
||||
const w = picker();
|
||||
press(items(w)[0]!);
|
||||
items(w)[0]!.element.dispatchEvent(new MouseEvent("mouseup", { bubbles: true, cancelable: true, button: 0 }));
|
||||
await w.vm.$nextTick();
|
||||
expect(items(w)[0]!.attributes("data-pressed")).toBeUndefined();
|
||||
});
|
||||
it("keeps an enabled tab entry after dynamically disabling the focused item", async () => {
|
||||
const off = shallowRef(false);
|
||||
const w = render(defineComponent({
|
||||
components: { ColorSwatchPicker, ColorSwatchPickerItem },
|
||||
setup: () => ({ off }),
|
||||
template: `<ColorSwatchPicker><ColorSwatchPickerItem color="#F43F5E" :is-disabled="off"/><ColorSwatchPickerItem color="#D946EF"/></ColorSwatchPicker>`,
|
||||
}));
|
||||
items(w)[0]!.element.focus();
|
||||
await w.vm.$nextTick();
|
||||
off.value = true;
|
||||
await w.vm.$nextTick();
|
||||
await w.vm.$nextTick();
|
||||
const root = w.get("[data-slot=color-swatch-picker]");
|
||||
const enabledTabEntries = [root, ...items(w)].filter(node => node.attributes("tabindex") === "0" && node.attributes("aria-disabled") !== "true");
|
||||
expect(enabledTabEntries).toHaveLength(1);
|
||||
});
|
||||
it("supports click-only activation used by assistive technology", async () => {
|
||||
const w = picker();
|
||||
items(w)[1]!.element.dispatchEvent(new MouseEvent("click", { bubbles: true, cancelable: true, detail: 0 }));
|
||||
await w.vm.$nextTick();
|
||||
expect(items(w)[1]!.attributes("aria-selected")).toBe("true");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user