🐛 fix(vscode): 悬停提示不用原生 title,webview 统一用自绘提示框,代码阅读的种类图标停上去能看到种类名
VS Code 1.139 带的 Electron 43 在 macOS 上只在鼠标压着带 title 的元素自身边缘时才弹原生提示, 停在它里面的图标、文字上不弹(electron/electron#49843,Electron 38 起)。种类图标 20px 的框 几乎被 16px 的图形占满,所以基本看不到种类名;块右上角按钮同样受影响。页面上核对过:图标中心点 命中的是图标里的线条,没有盖在上面的东西。 - components/ui/tooltip.tsx 改成整页只挂一次的 TooltipHost:元素只写 data-tooltip,事件统一交给它; 样子照 VS Code 悬停框(editorHoverWidget 那组变量、widget-shadow 阴影),停 500ms 才弹、弹着时换元素 立刻换,移开 / 按下 / 按键 / 滚动收起;键盘聚焦立刻弹,提示不是元素自己的名字时挂 aria-describedby - 代码阅读里所有 title(种类图标、块按钮、筛选栏、问答区、中文名的「原名」)改成 data-tooltip; SelectMenu 的 title 属性改名 tooltip;看板工单详情原来包一层的 Tooltip 也改成 data-tooltip - 何时弹 / 收的规则抽成纯函数加测试;更新代码阅读 spec
This commit is contained in:
1 parent
15790ce7c8
commit
ec34ace7cf
17 files changed
+399
-187
No files matched your search
@@ -42,14 +42,14 @@ describe('块下面的问答区', () => {
|
||||
expect(html.match(/data-history=""/g)).toHaveLength(2)
|
||||
expect(text(html)).toContain('为什么普通用户不能看别人的资料?3 天前')
|
||||
expect(text(html)).toContain('UserRole 还有哪些角色?昨天')
|
||||
expect(html.match(/title="已理解,删除" aria-label="已理解,删除"/g)).toHaveLength(2)
|
||||
expect(html.match(/data-tooltip="已理解,删除" aria-label="已理解,删除"/g)).toHaveLength(2)
|
||||
expect(text(html)).toContain('这是权限控制:不是管理员、又不是查自己时抛 Forbidden。')
|
||||
expect(html).toContain('<hr class="cr-qa-divider"/>')
|
||||
expect(html).toContain('data-current=""')
|
||||
expect(html).toContain('data-streaming=""><p><code>Forbidden</code> 定义在 <strong>core</strong></p>')
|
||||
expect(text(html)).toContain('读取 exceptions.py')
|
||||
expect(html).toContain('placeholder="继续问… Enter 发送,Esc 收起"')
|
||||
expect(html).toContain('title="停止" aria-label="停止"')
|
||||
expect(html).toContain('data-tooltip="停止" aria-label="停止"')
|
||||
expect(html).not.toContain('aria-label="发送"')
|
||||
})
|
||||
|
||||
@@ -80,7 +80,7 @@ describe('块下面的问答区', () => {
|
||||
const trigger = row.slice(row.lastIndexOf('<button', select), row.indexOf('</button>', select))
|
||||
expect(trigger).toContain('aria-haspopup="listbox"')
|
||||
expect(trigger).toContain('aria-expanded="false"')
|
||||
expect(trigger).toContain('title="用哪个 Claude Code 配置(profile)回答,下一个问题起用它"')
|
||||
expect(trigger).toContain('data-tooltip="用哪个 Claude Code 配置(profile)回答,下一个问题起用它"')
|
||||
expect(text(trigger)).toBe('sonnet')
|
||||
const none = render({ open: true, profiles: { options: [], selected: '' } })
|
||||
expect(text(none.slice(none.indexOf('cr-qa-profile')))).toContain('默认')
|
||||
|
||||
Reference in new issue
Block a user