feat(sidebar): 后台激活的页面不再顶掉读者,改为标记未读红点
维护者在 #817 上批准了「后台自动激活不接管右侧栏」的行为,并要求同批补上 「后台新开了页面」的提示:事件不能丢,但也不能把读者正在看的页面顶走。 行为: - 被门控跳过的那次激活仍然创建任务管理页,只是不再抢焦点 (`OpenTabSeed.reveal: false` → 宿主 `revealIfOpened: false`,即 「放置但不聚焦」;页面类型本来就没有自己的聚焦路径,已经存在的页面 再开一次也只是一次聚焦,正是门控要拒绝的那件事)。 - 该页在原生右栏芯片与插件底部工作台对应页签上显示一个静态小红点 (`aria-label` = 新词条 `tabUnread`,颜色取既有 `--dsw-alias-danger`)。 - 读者切到该页即清除标记:底部工作台走 service.activateTab;原生栏的 点击插件看不见(`ISidebarRight` 只有 `active()` 读取器,没有选中事件流), 所以由宿主自己的芯片按 `tab.visible` 清除——非可见芯片不清除, 否则宿主为每个展开页签都画标题,红点刚亮就会被抹掉。 - 标记存进会话状态的 `unread: TabType[]`(随布局持久化,跨挂载/跨会话/ 刷新都在),两个承载面读同一份,不会各自为政。 文案:20 份词典同批更新两条设置项描述(门控行为变了)+ 新增 `tabUnread` 词条(ja 真日文)。 测试:`tests/sidebar-auto-activation.spec.tsx` 的门控两条改为断言 「页面仍创建 + revealIfOpened:false + 标记出现」,并加红点生命周期与 「已在任务页/正常激活不标红」三条;新增 `tests/native-tab-unread.spec.tsx` 钉住原生芯片这一承载面(画点、按 visible 清除、非可见不清除、别的类型 不串味、不破坏可访问名)。判别性用 6 处镜像还原逐条证伪(见报告)。
This commit is contained in:
1 parent
9c18f05441
commit
de1e76e2f5
33 files changed
+654
-57
No files matched your search
@@ -257,6 +257,12 @@ export function createNativeSurface(ctx: Context, records: NativeTabRecords): Na
|
||||
fileAddress(sessionId, cwd, path) {
|
||||
return fileAddressFor(sessionId, cwd, path)
|
||||
},
|
||||
tabTypeOf(sessionId, tabId) {
|
||||
// Read through the SESSION, like `close` above: one native id names a
|
||||
// tab in every session, so a bare read can hand back another session's
|
||||
// record and clear the wrong session's unread mark.
|
||||
return records.get(sessionId, tabId)?.tab.type
|
||||
},
|
||||
close(sessionId, tabId) {
|
||||
// Read through the SESSION: the same native id names a tab in every
|
||||
// session, so a bare read can hand back another session's record.
|
||||
|
||||
Reference in new issue
Block a user