From 28972a0e8ee1141ac56fcb79c429bd453ba17290 Mon Sep 17 00:00:00 2001 From: HIsheR Date: Tue, 27 Oct 2026 02:14:56 +0800 Subject: [PATCH] =?UTF-8?q?iter(g338):=20toast=20=E8=AF=BB=E5=B1=8F?= =?UTF-8?q?=E5=8F=AF=E8=BE=BE=E4=B8=8E=E6=8A=A2=E5=8D=A0=E6=92=AD=E6=8A=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .ua/backlog.json | 9 +++++++++ packages/skin/ui/src/toast.ts | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.ua/backlog.json b/.ua/backlog.json index 3b5ee29..686d9e9 100644 --- a/.ua/backlog.json +++ b/.ua/backlog.json @@ -3428,6 +3428,15 @@ "motivation": "本轮修输入件可访问名时发现口径靠人记:13 个组件都有 ariaLabel,commandPalette 的搜索框却只有 role=combobox + aria-controls,没有名字——读屏进命令面板只念「编辑框」,用户不知道搜什么。这类缺陷肉眼看不出来(placeholder 看着像有名字),只有读屏用户会撞上,必须让门禁兜住。", "acceptance": "① ua verify 新增 checkAriaNames:扫描皮肤包源码里含 role: 'combobox' / role: 'slider' / type: 'range' 的创建块,块内既无 aria-label / aria-labelledby、紧随其后 3 行也没有 setAttribute('aria-label') 即报错,报出文件:行号;② 窗口只取单次 h() 调用块(回退到 h('input|textarea|select'、前进到收尾行),避免把相邻元素的 aria-label 误算成本控件的名字;③ 实跑抓到 commandPalette 一处并修好(aria-label 取 placeholder,缺省「搜索命令」);④ AGENTS 的门禁说明与 verify 成功串同步;⑤ npm run check 全绿。", "notes": "" + }, + { + "id": "g338", + "domain": "tune", + "title": "toast 通知读屏可达", + "motivation": "toast 目前只走视觉通道,读屏用户完全感知不到通知的出现与消失", + "acceptance": "toast 容器带 aria-live=polite,error 级别用 role=alert 抢占播报;audit 与 verify 全绿", + "status": "open", + "notes": "" } ] } diff --git a/packages/skin/ui/src/toast.ts b/packages/skin/ui/src/toast.ts index 21d70c9..d127c61 100644 --- a/packages/skin/ui/src/toast.ts +++ b/packages/skin/ui/src/toast.ts @@ -9,7 +9,7 @@ const PAUSE_FLOOR = 400; // 恢复时的最短剩余毫秒:悬停前已近归 /*** 确保堆叠容器存在:fixed 挂在 body 末尾,后续消息依次向上堆叠 ***/ function ensureHost(): HTMLElement { if (host) return host; - host = h('div', { class: 'ua-toast-host' }); + host = h('div', { class: 'ua-toast-host', 'aria-live': 'polite', 'aria-atomic': 'false' }); // live 容器兜底播报:条目自身 role 再定抢占级别 document.body.appendChild(host); return host; } @@ -30,7 +30,7 @@ export function showToast(props: ToastProps): HTMLElement { let startedAt = 0; // 本段计时起点,用于折算剩余 const item = h( 'div', - { class: `ua-toast ua-toast-${props.variant ?? 'info'}${props.closable ? ' is-closable' : ''}${props.actionLabel ? ' is-action' : ''}`, role: 'status', id: `ua-toast-${++seq}` }, + { class: `ua-toast ua-toast-${props.variant ?? 'info'}${props.closable ? ' is-closable' : ''}${props.actionLabel ? ' is-action' : ''}`, role: props.variant === 'danger' ? 'alert' : 'status', id: `ua-toast-${++seq}` }, // error 抢占播报,其余礼貌播报 h('span', { class: 'ua-toast-msg' }, props.message), props.actionLabel ? h('button', { type: 'button', class: 'ua-toast-action', onClick: () => { dismiss(item); props.onAction?.(); } }, props.actionLabel) // 操作按钮(如撤销):点完立即收起再回调