fix(a11y): expose Collapsible expanded state + keyboard focus

pr-agent #407 二次反馈:toggle button 缺 aria-expanded(屏幕阅读器无法判断
当前组是否展开),并且 outline: 'none' 把浏览器默认 keyboard focus indicator
也抹掉了(Tab 切换时丢失视觉焦点)。

修复:
- 加 aria-expanded={open}
- 移除 outline: 'none',让浏览器默认 focus ring 显示出来
This commit is contained in:
baiqing committed 2026-05-12 00:55:26 +08:00
1 parent e44dcbc7f1
commit 50daab11e2
1 file changed
+3 -1
+3 -1
View File
@@ -184,12 +184,14 @@ export function Collapsible({ title, desc, defaultOpen = false, embedded = false
<button
type="button"
onClick={() => setOpen(o => !o)}
aria-expanded={open}
// 让屏幕阅读器朗读折叠状态;键盘 focus 保留浏览器默认 outline 而不是
// outline: 'none',避免 Tab 切换时丢失视觉焦点指示(pr-agent #407 反馈)。
style={{
width: '100%',
padding: '14px 18px',
background: 'transparent',
border: 0,
outline: 'none',
textAlign: 'left',
fontFamily: 'inherit',
color: 'inherit',