Repository navigation
fix(wheel): 数字键恒选花瓣不串搜索;超范围给 keyRange 提示 - #18
Conversation
| const els = $$('.petal'); | ||
| if (matches[n - 1] && els[n - 1]) pick(els[n - 1], matches[n - 1]); | ||
| if (n >= 1 && matches[n - 1] && els[n - 1]) { pick(els[n - 1], matches[n - 1]); return; } | ||
| if (matches.length) toast('info', t('wh.keyRange', { n: matches.length }), 1400); |
There was a problem hiding this comment.
🟡 Invalid key repeats block wheel petals
Holding an invalid digit makes toast stack up to five hints across the 320-pixel wheel. The hints cover petals and intercept clicks until they expire.
Learn more
Each repeated keydown for an invalid digit creates a separate toast. The toast helper retains up to five messages for 1.4 seconds each, and the toast layout places them above the wheel's bottom edge with pointer events enabled. Several messages span the wheel's petal positions and intercept clicks even after the key is released.
Example: Hold 7 while six petals are visible. Keyboard repeat quickly creates five range hints. The hints overlap the lower petals, so clicking one hits a toast rather than selecting a prompt.
Recommended fix: Coalesce repeated wh.keyRange notifications into one visible toast, or replace and reset a single range hint. Verify that holding an invalid key leaves the petals clickable.
Was this helpful? React with 👍 or 👎 to provide feedback.
回应 Devin Review on PR #18:按住超范围数字时 keydown 自动重复, 每次重复都新建一个 toast,最多叠 5 个,盖住下半花瓣并拦截点击。 - toast() 增 key 参数:同 key 的在世提示直接替换内容并重置计时器 - .toast 补 pointer-events:none(纵深防御,任何 toast 都不该拦点击) - e2e 补 2 条断言:按住 7 只出 1 个 toast + toast 不拦截花瓣点击 - 第 8 条断言原假设「每次新增」(count 增长),改为断言提示内容正确 (契约变了:keyed toast 是替换不是堆叠,不是放水)
|
已修复,见 根因: 修法(两层):
测试(
一处契约变更说明:原第 8 条断言写的是 全量回归:5 个 e2e 套件全 ALL PASS; |
问题
轮盘有第二页时,按 7/8/9(以及短页的超范围数字)会掉进打字过滤分支,
query += e.key把数字塞进搜索框——搜索内容突然变了,用户完全不知道发生了什么。用户原话:「现在轮盘会有第二页,但是前端第二页第一个会显示 1,但是其实对应的快捷键应该是 7 对不对?还是 1 呢?」
定案:还是按 1(页内序号)
序号与按键的对应关系本来就没断(花瓣画 1,按 1 选它)。真正断的是无效数字键的处置。
不改成全局序号(按 7)的理由:键盘只有 1-9,
PAGE=6,第二页要按 7-12,第三页直接没键可用。页内序号 + ←/→ 翻页是唯一能扩展的方案。改动
src/js/wheel.js:215-227:数字键分支从n <= PAGE改为/^\d$/全数字统一走选择:pick()选中该花瓣wh.keyRangetoast(1.4s)提示「本页只有 {n} 项,按 1–{n} 选择」query(0、7-9、短页超范围键统一处理)src/js/i18n/{zh-CN,en-US}.js:新增wh.keyRange。UI 决策:不加常驻文案
中心圆只有 56px,已有
1/2页码。误按数字时弹出的 toast 恰好在困惑发生的那一刻教学规则,比常驻小字更符合「需要时出现」。测试
新增
tests/e2e/wheel_page_keys_e2e.py(249 行,20 项),含专门抓本 bug 的断言digit 9 does not append to query。Rust 侧未动,纯前端 fix;
node --check三个改动文件均通过。