diff --git a/apps/web/tests/expected/sidebar-drawer.expected.md b/apps/web/tests/expected/sidebar-drawer.expected.md index 404e3df29e..466c2d6ccf 100644 --- a/apps/web/tests/expected/sidebar-drawer.expected.md +++ b/apps/web/tests/expected/sidebar-drawer.expected.md @@ -10,7 +10,7 @@ tooltips: sidebar and workspace controls escape the drawer and fit the viewport search input: 16px on touch; 13px with a fine pointer simulated keyboard: homepage and drawer retain 844px layout height without following the 360px visual viewport; Settings stays within the viewport keyboard close: layout height stays 844px; sidebar search retained; Settings close remains reachable -safe areas: drawer backing and mask cover 844px; content retains 56px top and 34px bottom insets +shell coverage: drawer backing and mask cover 844px without synthetic safe-area insets rotation: 844x390 then 390x844 restores shell height and sidebar breakpoint folded landscape: 951px frame splits at 475.5px without a resize handle; unfolding restores 280px and search focus; portrait retains the drawer fold transitions: sidebar controls follow the divider in both directions; reduced motion changes width without animation diff --git a/apps/web/tests/sidebar-drawer.e2e.ts b/apps/web/tests/sidebar-drawer.e2e.ts index 53a9075abb..c360eb86f2 100644 --- a/apps/web/tests/sidebar-drawer.e2e.ts +++ b/apps/web/tests/sidebar-drawer.e2e.ts @@ -331,12 +331,6 @@ it('overlays the conversation and closes after navigation without losing its sid await restoreViewport.dispose() await expect.poll(() => root.boundingBox()).toEqual({ x: 0, y: 0, width: 390, height: 844 }) await expect.poll(async () => (await drawer.boundingBox())?.height).toBe(844) - // Desktop Chromium supplies zero safe-area insets; exercise the shell's - // inset properties with the same geometry as a phone's protected edges. - await root.evaluate((el) => { - el.style.setProperty('--dsh-safe-area-top', '56px') - el.style.setProperty('--dsh-safe-area-bottom', '34px') - }) await frame.evaluate((el) => { el.scrollLeft = 10 }) expect(await frame.evaluate(el => el.scrollLeft)).toBe(0) await expect.poll(() => mask.boundingBox()).toEqual({ x: 0, y: 0, width: 390, height: 844 }) @@ -347,14 +341,6 @@ it('overlays the conversation and closes after navigation without losing its sid const { y, height } = column.getBoundingClientRect() return { y, height } })).toEqual({ y: 0, height: 844 }) - await expect.poll(async () => { - const box = await drawer.boundingBox() - return { y: box?.y, height: box?.height } - }).toEqual({ y: 56, height: 754 }) - await root.evaluate((el) => { - el.style.removeProperty('--dsh-safe-area-top') - el.style.removeProperty('--dsh-safe-area-bottom') - }) await expect.poll(async () => (await drawer.boundingBox())?.height).toBe(844) await page.setViewportSize({ width: 844, height: 390 }) await expect.poll(async () => (await root.boundingBox())?.height).toBe(390) @@ -471,7 +457,7 @@ it('overlays the conversation and closes after navigation without losing its sid 'search input: 16px on touch; 13px with a fine pointer', 'simulated keyboard: homepage and drawer retain 844px layout height without following the 360px visual viewport; Settings stays within the viewport', 'keyboard close: layout height stays 844px; sidebar search retained; Settings close remains reachable', - 'safe areas: drawer backing and mask cover 844px; content retains 56px top and 34px bottom insets', + 'shell coverage: drawer backing and mask cover 844px without synthetic safe-area insets', 'rotation: 844x390 then 390x844 restores shell height and sidebar breakpoint', 'folded landscape: 951px frame splits at 475.5px without a resize handle; unfolding restores 280px and search focus; portrait retains the drawer', 'fold transitions: sidebar controls follow the divider in both directions; reduced motion changes width without animation', @@ -577,3 +563,83 @@ it('uses arrows inside one tree entry and keeps pointer focus from pinning row a } finally { await browser.close() } } finally { await scaffold.close() } }) + +it('keeps drawer shortcuts and hit targets above fullscreen and floating right panels', async () => { + const scaffold = await launchWebScaffold({ + extraOverlayPath: fileURLToPath(new URL('./pin-browse-picker.overlay.yml', import.meta.url)), + }) + try { + const workspace = await scaffold.ctx.workspaceRegistry.create(scaffold.workspaceCwd) + const seed = await readFile(new URL('../../../snapshots/web/seeded-history/session.v3.jsonl', import.meta.url), 'utf8') + const sessionId = await seedSession(scaffold, seed, 'session-c4421b66-252e-44c0-80ed-6e320abeba25') + await workspace.attachSession(sessionId) + await scaffold.ctx.sessionController.rename({ sessionId, title: 'Drawer overlay checks' }) + const browser = await chromium.launch() + try { + const page = await browser.newPage({ viewport: { width: 1280, height: 844 }, locale: 'en-US' }) + await page.addInitScript(() => { Object.defineProperty(navigator, 'platform', { value: 'MacIntel' }) }) + await page.goto(scaffold.authenticatedUrl) + const row = page.getByRole('treeitem').filter({ has: page.getByText('Drawer overlay checks', { exact: true }) }) + await row.click() + await page.locator('[data-sidebar-right-expand]').click() + await page.locator('[data-sidebar-right-guide-entry="files"]').click() + const panel = page.locator('[data-sidebar-right-open]') + const primary = await page.evaluate(() => /mac/i.test(navigator.platform) ? 'Meta' : 'Control') + const toggle = `${primary}+Alt+b` + await row.hover() + const card = page.getByRole('button', { name: 'Copy: Drawer overlay checks', exact: true }) + await card.waitFor() + await page.setViewportSize({ width: 390, height: 844 }) + await card.waitFor({ state: 'hidden' }) + expect(await row.count()).toBe(1) + const drawer = page.getByRole('dialog', { name: 'Navigation', exact: true }) + await expect.poll(() => panel.getAttribute('data-sidebar-right-panel')).toBe('fullscreen') + const assertAboveRightPanel = async (coveredPoint?: { x: number; y: number }) => { + await page.locator('[data-sidebar-drawer][data-sidebar-collapsed]').waitFor() + await page.keyboard.press(toggle) + await drawer.waitFor() + const collapse = drawer.getByRole('button', { name: 'Collapse sidebar', exact: true }) + await expect.poll(() => collapse.evaluate(el => document.activeElement === el)).toBe(true) + await expect.poll(() => drawer.evaluate((el) => { + const box = el.getBoundingClientRect() + return el.contains(document.elementFromPoint(box.left + 140, 30)) + })).toBe(true) + expect(await page.evaluate(() => document.elementFromPoint(380, 420)?.hasAttribute('data-sidebar-mask'))).toBe(true) + if (coveredPoint !== undefined) { + expect(await drawer.evaluate((el, point) => { + const hit = document.elementFromPoint(point.x, point.y) + return el.contains(hit) || hit?.hasAttribute('data-sidebar-mask') + }, coveredPoint)).toBe(true) + } + await page.keyboard.press(`${primary}+Alt+k`) + await expect.poll(() => drawer.getByPlaceholder('Search session names').evaluate(el => document.activeElement === el)).toBe(true) + await page.keyboard.press(toggle) + await drawer.waitFor({ state: 'hidden' }) + expect(await panel.evaluate(el => el.closest('[inert]') === null)).toBe(true) + } + await assertAboveRightPanel() + await page.setViewportSize({ width: 1280, height: 844 }) + await expect.poll(() => panel.getAttribute('data-sidebar-right-panel')).toBe('push') + const tab = panel.locator('[data-dockkit-tab]').filter({ hasText: 'Files' }) + const bounds = (await tab.boundingBox())! + await page.mouse.move(bounds.x + 6, bounds.y + bounds.height / 2) + await page.mouse.down() + try { + await page.mouse.move(190, 400, { steps: 8 }) + } finally { await page.mouse.up() } + const floating = page.locator('[data-dockkit-float]') + await floating.waitFor() + await page.setViewportSize({ width: 390, height: 844 }) + const box = (await floating.boundingBox())! + expect(box.x).toBeLessThan(390) + expect(box.x + box.width).toBeGreaterThan(0) + const point = { x: (Math.max(0, box.x) + Math.min(390, box.x + box.width)) / 2, y: box.y + 40 } + await expect.poll(() => floating.evaluate((el, at) => el.contains(document.elementFromPoint(at.x, at.y)), point)).toBe(true) + await assertAboveRightPanel(point) + } finally { + await browser.close() + } + } finally { + await scaffold.close() + } +}) diff --git a/packages/client/ui-dockkit/README.i18n.yaml b/packages/client/ui-dockkit/README.i18n.yaml index 23d3c8e84a..9e65cf4c83 100644 --- a/packages/client/ui-dockkit/README.i18n.yaml +++ b/packages/client/ui-dockkit/README.i18n.yaml @@ -18,8 +18,8 @@ en: ea872ff2c2089037 zh: b3ec3a218eacd5c8 /deepseek-ai-dsh-client-ui-dockkit/embedding-it: - en: 47b9852393643b6a - zh: ce5f2ab60eec9564 + en: 78bf57f52daa97cb + zh: 0a057bf648f7667a /deepseek-ai-dsh-client-ui-dockkit/interaction-rules-worth-keeping: en: 7e5c1e9a9f9f244f zh: 7e3a8fcef86bc7dd diff --git a/packages/client/ui-dockkit/README.md b/packages/client/ui-dockkit/README.md index 9ca8b6c447..68699896fb 100644 --- a/packages/client/ui-dockkit/README.md +++ b/packages/client/ui-dockkit/README.md @@ -56,6 +56,8 @@ Everything host-specific arrives through props: `dropZones="horizontal"` offers two half-pane hints; once budget or width forbids another split, the whole body accepts a move. A hint is a dashed card inset 8px inside its region, showing the zone's glyph and `labels.dropZone[zone]`; the preview layer covers all tab-body content, while the card under the pointer takes the accent and its neighbour stays a quiet outline. `minPaneFraction` sets the preview minimum, and `planResizeSplit` accepts the same minimum for the committed operation. The Sidebar uses 0.2 and enforces two panes in its own store. The generic engine retains its tree and other split directions. `hideSplitWhenBlocked` hides a blocked split control — pane budget spent or pane too narrow — instead of rendering it disabled; its default is false. +The split control wrapper exposes `data-dockkit-split-control` for embedder styling, independently of its element tag. + A tab's `kind` is an opaque string. Seeded tabs are factories (`DockControllerOptions`), so what a fresh pane contains is the embedder's decision, not this package's. Content identity is the pair (`kind`, `contentId`): `findContentTab(state, contentId, kind?)` finds the tab showing it anywhere and `findPaneContentTab(state, paneId, contentId, kind?)` within one pane, and `planOpenContent` focuses that tab instead of opening another unless told `revealIfOpened: false`; an explicit `index` seats a new tab at a strip slot rather than at the end. `DockLayout`, used by the Sidebar, keeps each tab in a stable DOM cell across selection, pane moves and floating. It accepts one docked pane or two horizontal panes; CSS Grid resolves their widths. `keepMounted(tab)` retains visited bodies and `active` controls Session visibility without reparenting content. diff --git a/packages/client/ui-dockkit/README.zh.md b/packages/client/ui-dockkit/README.zh.md index b0104aa678..162c9a39ed 100644 --- a/packages/client/ui-dockkit/README.zh.md +++ b/packages/client/ui-dockkit/README.zh.md @@ -56,6 +56,8 @@ kind: "package-reference" `dropZones="horizontal"` 提供左右两个半区提示;预算或宽度不允许再拆时,正文整格接收移动。提示是一张内缩 8px 的虚线卡片,显示该落区的图形和 `labels.dropZone[zone]`;预览层覆盖全部 tab 正文,指针所在的卡片取强调色,另一张保持安静的轮廓。`minPaneFraction` 控制预览的最小比例,`planResizeSplit` 接受相同最小值以约束提交;Sidebar使用0.2并在自己的store限制两格。通用引擎仍保留原有树与其它分割方向。 `hideSplitWhenBlocked` 在分栏被阻止时(窗格预算已满或格太窄)直接隐藏分栏控件而不是渲染禁用态,默认值为 false。 +分栏控件的包裹元素通过 `data-dockkit-split-control` 提供宿主样式入口,不依赖具体元素标签。 + tab 的 `kind` 是不透明字符串。种子 tab 是工厂(`DockControllerOptions`),因此新格里放什么由嵌入方决定,与本包无关。内容身份是二元组(`kind`、`contentId`):`findContentTab(state, contentId, kind?)` 在任意位置找到展示它的 tab,`findPaneContentTab(state, paneId, contentId, kind?)` 在一个格内找;`planOpenContent` 会聚焦该 tab 而非再开一个,除非被告知 `revealIfOpened: false`;显式的 `index` 把新 tab 放到 tab 条的某个位置而非末尾。 Sidebar 使用的 `DockLayout` 在选中项变化、跨格移动与浮动期间,把每个 tab 保留在稳定的 DOM 容器中。它接受一个停靠格或左右两个格,由 CSS Grid 计算宽度。`keepMounted(tab)` 保留已访问正文,`active` 控制 Session 可见性,不改变内容的父子关系。 diff --git a/packages/client/ui-dockkit/src/components/TabPanel.tsx b/packages/client/ui-dockkit/src/components/TabPanel.tsx index 195b697914..8d16be2eb6 100644 --- a/packages/client/ui-dockkit/src/components/TabPanel.tsx +++ b/packages/client/ui-dockkit/src/components/TabPanel.tsx @@ -367,6 +367,7 @@ export function TabStrip({ state, pane, callbacks }: TabPanelProps): ReactNode { {!(callbacks.hideSplitWhenBlocked && block !== undefined) && ( diff --git a/packages/client/ui-dockkit/tests/components.client.spec.tsx b/packages/client/ui-dockkit/tests/components.client.spec.tsx index dccbe129a4..598708fadc 100644 --- a/packages/client/ui-dockkit/tests/components.client.spec.tsx +++ b/packages/client/ui-dockkit/tests/components.client.spec.tsx @@ -280,6 +280,7 @@ describe('DockSurface', () => { expect(disabled.hasAttribute('disabled')).toBe(true) expect(disabled.parentElement?.getAttribute('aria-label')).toBe(TEST_LABELS.splitPaneDisabled) expect(disabled.getAttribute('data-dockkit-split-blocked')).toBe('budget') + expect(disabled.parentElement?.hasAttribute('data-dockkit-split-control')).toBe(true) }) it('names the enabled split control through the shared tooltip, not a native title', () => { diff --git a/packages/client/ui-layout/README.i18n.yaml b/packages/client/ui-layout/README.i18n.yaml index eeec40c2ad..75bda0d492 100644 --- a/packages/client/ui-layout/README.i18n.yaml +++ b/packages/client/ui-layout/README.i18n.yaml @@ -15,8 +15,8 @@ en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-ui-layout/use-this-package: - en: 38023531069269dd - zh: f8ae2ad72cadc56a + en: 762116247685afd7 + zh: cfb0767cb6c7e923 /deepseek-ai-dsh-client-ui-layout/use-this-package/window-chrome-seat: en: 7eac53b38d0777fe zh: 7f9422dff671ba50 diff --git a/packages/client/ui-layout/README.md b/packages/client/ui-layout/README.md index c3681c954b..3063101d5c 100644 --- a/packages/client/ui-layout/README.md +++ b/packages/client/ui-layout/README.md @@ -25,13 +25,13 @@ This package provides the Web GUI's three-column AppFrame, edge-column widths, a ## Use this package -Desktop Mod+B toggles the left sidebar through the same layout action used by its controls. The shortcut command is unavailable behind modal dialogs and yields to terminal input. +Desktop Mod+B toggles the left sidebar through the same layout action used by its controls. The shortcut remains available inside the navigation drawer, is unavailable behind other modal dialogs, and yields to terminal input. The root slot composes the sidebar, main content, and right column. The sidebar spans 264–420px, defaults to 280px, and retains a 56px rail when collapsed at widths of 768px and above. Below 768px, without a native Windows caption, it uses a modal drawer without reserving a column; the header retains the reopen controls, and navigation closes the drawer. Below 1024px it collapses automatically, and opening the right panel collapses a manually expanded sidebar. The right panel first opens at 45% of the viewport, then retains the user's pixel preference, capped at 70%. To protect 400px for the center, the frame first reduces the right panel to 300px, then reports insufficient room so its occupant closes it, and only then compresses the center further. Dragging has no transition delay; the right handle is absent while closed or fullscreen. When the browser reports a folded device in landscape and the frame is at least 768px wide, the expanded sidebar occupies half the frame, aligning its divider with the center fold. Its resize handle is hidden; unfolding restores the saved width. Fold changes at a stable viewport width use the existing track transition; reduced motion disables it. Browsers without the device-posture media feature keep the ordinary layout. -The drawer mask fades with the panel’s transition duration and easing on both open and close; reduced motion disables both transitions. Entering drawer mode from an already collapsed sidebar hides the drawer immediately; an expanded sidebar keeps its closing slide. The drawer has no edge divider, and its frame does not scroll. The frame fills the shell’s layout viewport, retaining its height while the keyboard opens. Drawer backing and mask cover its full height, including the top and bottom safe areas and `shell.bottom`; frame and drawer content retain the safe-area insets once. +The drawer mask fades with the panel’s transition duration and easing on both open and close; reduced motion disables both transitions. Entering drawer mode from an already collapsed sidebar hides the drawer immediately; an expanded sidebar keeps its closing slide. The drawer has no edge divider, and its frame does not scroll. The frame fills the shell’s layout viewport, retaining its height while the keyboard opens. Drawer backing and mask cover the shell’s full height, including `shell.bottom`, above fullscreen and floating right panels. Browser-owned status and address bars remain outside the shell; the layout adds no synthetic safe-area insets. Global panels occupy the root-scoped `main` keyed slot; `conversation` is the reserved key for the Conversation. `ctx.layout.selectPanel(id)` selects a registered panel, and `null` selects the Conversation without changing the current Session. The Plugins page contributes one of the shipped global panels. diff --git a/packages/client/ui-layout/README.zh.md b/packages/client/ui-layout/README.zh.md index 65edecd3ef..005bf6d538 100644 --- a/packages/client/ui-layout/README.zh.md +++ b/packages/client/ui-layout/README.zh.md @@ -25,13 +25,13 @@ kind: "package-reference" ## 使用本包 -桌面 Mod+B 通过与控件共用的布局操作切换左侧栏。模态弹窗打开时此快捷键不可用;终端输入优先。 +桌面 Mod+B 通过与控件共用的布局操作切换左侧栏。此快捷键在导航抽屉内仍可用,在其他模态弹窗打开时不可用;终端输入优先。 本插件在 root slot 中组合侧边栏、主内容和右栏。侧边栏宽度为 264~420px,默认为 280px,在宽度不低于 768px 时,收起后保留 56px 控制栏。低于 768px 且没有原生 Windows 顶栏时,采用模态抽屉,不占据列宽;标题区域保留重新打开的控件,导航后关闭抽屉。窗口宽度低于 1024px 时自动收起,打开右侧面板也会收起手动展开的侧边栏。右侧面板首次打开时使用视口宽度的 45%,之后保留用户的像素宽度偏好,上限为 70%。为给中栏保留 400px,框架先将右侧面板缩减至 300px,再报告空间不足,使占用方将其关闭,最后才进一步压缩中栏。拖动没有过渡延迟;右侧手柄在关闭或全屏时不显示。 当浏览器报告设备处于横屏半折叠状态,且框架宽度不低于 768px 时,展开的侧边栏占据一半宽度,分隔线与屏幕中央的折痕对齐。此时隐藏拖拽手柄;完全展开后恢复保存的宽度。视口宽度不变时,折叠状态切换复用现有的列宽过渡;减少动态效果时禁用该过渡。不支持 device-posture 媒体特性的浏览器继续使用常规布局。 -抽屉遮罩使用与面板相同的时长和缓动,在打开与关闭时渐变透明度;减少动态效果时两者均不播放动画。从已收起的侧栏切换到抽屉布局时,抽屉立即隐藏;已展开的侧栏保留收起动画。抽屉边缘不绘制分隔线,外层框架不滚动。框架铺满外壳的布局视口,在键盘抬起时保留原有高度。抽屉背景和遮罩覆盖完整高度,包括上下安全区与 `shell.bottom`;框架和抽屉的内容各保留一次安全区边距。 +抽屉遮罩使用与面板相同的时长和缓动,在打开与关闭时渐变透明度;减少动态效果时两者均不播放动画。从已收起的侧栏切换到抽屉布局时,抽屉立即隐藏;已展开的侧栏保留收起动画。抽屉边缘不绘制分隔线,外层框架不滚动。框架铺满外壳的布局视口,在键盘抬起时保留原有高度。抽屉背景和遮罩覆盖外壳完整高度,包括 `shell.bottom`,并显示在全屏和浮动右侧面板之上。浏览器管理的状态栏和地址栏位于外壳之外;布局不添加模拟安全区边距。 全局面板占据 root 作用域的 `main` keyed slot;`conversation` 是为会话界面保留的 key。`ctx.layout.selectPanel(id)` 选中已注册面板,`null` 则选中会话界面,但不改变当前会话。Plugins 页面是默认组合中的一个全局面板。 diff --git a/packages/client/ui-layout/src/client/AppFrame.module.css b/packages/client/ui-layout/src/client/AppFrame.module.css index bfe09fc483..3be77665ef 100644 --- a/packages/client/ui-layout/src/client/AppFrame.module.css +++ b/packages/client/ui-layout/src/client/AppFrame.module.css @@ -4,7 +4,6 @@ grid-template-rows: minmax(0, 1fr) auto; height: 100%; box-sizing: border-box; - padding-block: var(--dsh-safe-area-top, 0px) var(--dsh-safe-area-bottom, 0px); overflow: hidden; background: var(--dsw-alias-bg-base); } @@ -299,10 +298,9 @@ position: absolute; grid-area: auto; inset: 0 auto 0 0; - z-index: 31; + z-index: 71; box-sizing: border-box; border-right: none; - padding-block: var(--dsh-safe-area-top, 0px) var(--dsh-safe-area-bottom, 0px); transform: translateX(0); visibility: visible; transition: transform var(--ds-transition-duration-slow) var(--ds-ease-in-out); @@ -323,7 +321,7 @@ .drawerMask { position: absolute; inset: var(--dsh-frame-chrome-top, 0px) 0 0; - z-index: 30; + z-index: 70; background: var(--dsw-alias-bg-mask-1); backdrop-filter: var(--dsw-mask-blur); opacity: 0; @@ -337,7 +335,7 @@ } .frame[data-sidebar-drawer] .leadingSeat { - top: calc(11px + var(--dsh-safe-area-top, 0px)); + top: 11px; left: 12px; } diff --git a/packages/client/ui-layout/src/client/index.ts b/packages/client/ui-layout/src/client/index.ts index 9db11b9e88..8e36f692b7 100644 --- a/packages/client/ui-layout/src/client/index.ts +++ b/packages/client/ui-layout/src/client/index.ts @@ -212,7 +212,7 @@ export function apply(ctx: ClientContext): void { 'web:macos': { code: 'KeyB', modifiers: ['primary', 'alt'] }, 'web:windows': { code: 'KeyB', modifiers: ['primary', 'alt'] }, }, - regions: ['page', 'editable'], modals: [], + regions: ['page', 'editable'], modals: ['sidebar'], resolve: () => ({ status: 'handled', run: () => { layout.toggleSidebar() } }), }) const disposePanels = ctx.slots.subscribe('main', retainMainPanels) diff --git a/packages/client/ui-primitives/README.i18n.yaml b/packages/client/ui-primitives/README.i18n.yaml index d258546044..1ad16c672f 100644 --- a/packages/client/ui-primitives/README.i18n.yaml +++ b/packages/client/ui-primitives/README.i18n.yaml @@ -21,8 +21,8 @@ en: cb874a0ca53a6747 zh: 31179193dd1d6e12 /deepseek-ai-dsh-client-ui-primitives/use-this-package/controls-and-icons: - en: 09c61f61c560f8a2 - zh: 895ac73add1199b8 + en: 9400611fcfd53402 + zh: 753dedbcaafba974 /deepseek-ai-dsh-client-ui-primitives/use-this-package/rendering-agent-output: en: 3a31ad8de6dd0af8 zh: 6b22881a929c33df diff --git a/packages/client/ui-primitives/README.md b/packages/client/ui-primitives/README.md index e8c8d5942e..06fb09265b 100644 --- a/packages/client/ui-primitives/README.md +++ b/packages/client/ui-primitives/README.md @@ -96,6 +96,8 @@ The catalog above lists what each export is for; this section covers the behavio `HoverCardGroup` owns private state for one mounted physical list. A `HoverCard` with `grouped` shares the first actually displayed card's dwell: subsequent cards replace the current card immediately during the same pointer interaction. The list and its active portaled card form one pointer interaction: the pointer may enter the card to read or copy, then return to another list item for immediate replacement. After the pointer leaves both, the shared dwell resets when the active card closes through its existing pointer-grace and close lifecycle; the group adds no separate timer. Leaving a list with no active card resets the dwell immediately. Opening an inline card by keyboard focus while the pointer is outside the list does not warm the next pointer visit. Exclusive display includes fading previews: ordinary preview dismissal retains its fade, but a group replacement removes the previous card immediately. Cards without `grouped` remain independent. +An open hover card closes immediately when an ancestor of its anchor becomes inert or hidden. + ### Rendering agent output The nearest `MarkdownDelegateProvider` supplies optional `openExternalLink` and `openFile` navigation callbacks. Nested providers replace the enclosing capabilities, and callback changes reach already-rendered links without rebuilding Markdown. Its `openFile` makes local Markdown links clickable after settlement. Absolute and workspace-relative paths support percent escapes and `#L24` / `#L24-L30` fragments; ranges open at their first line. Literal `?` and `#` in filenames must be percent-encoded. The tooltip uses the decoded path and supplies the accessible name when the label is empty. The callback receives the decoded path and optional line, while the renderer preserves the label and displays a file icon. Without a callback, local links remain text. URL schemes, queries, unsupported fragments, and malformed destinations never reach the file opener. diff --git a/packages/client/ui-primitives/README.zh.md b/packages/client/ui-primitives/README.zh.md index 0fdc83d278..08a84f3cef 100644 --- a/packages/client/ui-primitives/README.zh.md +++ b/packages/client/ui-primitives/README.zh.md @@ -96,6 +96,8 @@ kind: "package-library" `HoverCardGroup` 为一个已挂载的物理列表持有私有状态。设置 `grouped` 的 `HoverCard` 共享首张实际显示卡片的等待:在同一次指针交互中,后续卡片立即替换当前卡片。列表与其当前活动的 portal 卡片构成一次指针交互:指针可进入卡片阅读或复制,再返回其他列表项并立即替换卡片。指针离开两者后,共享等待在活动卡片通过原有指针宽限及关闭生命周期关闭时重置;分组不另设计时器。列表没有活动卡片时,指针离开便立即重置等待。指针位于列表外时,通过键盘聚焦打开行内卡片不会让下一次指针进入跳过等待。互斥显示也包括正在淡出的预览:普通预览关闭保留淡出,但分组内替换会立即移除前一张卡片。未设置 `grouped` 的卡片保持独立。 +锚点的祖先变为 inert 或隐藏时,已打开的悬浮卡片立即关闭。 + ### 渲染 agent 输出 最近的 `MarkdownDelegateProvider` 提供可选的 `openExternalLink` 和 `openFile` 导航回调。嵌套 Provider 替换外层能力,回调变化无需重新构建 Markdown 即可到达已渲染链接。其 `openFile` 使本地 Markdown 链接在落定后可点击。绝对路径和工作区相对路径支持百分号转义以及 `#L24` / `#L24-L30` 片段;范围定位到起始行。文件名中的字面 `?` 和 `#` 必须百分号编码。悬停提示使用解码后的路径,并在标签为空时提供可访问名称。回调接收解码后的路径和可选行号,渲染器保留标签并显示文件图标。不传回调时,本地链接仍为文本。URL 协议、查询串、不支持的片段及格式错误的目标不会传给文件打开器。 diff --git a/packages/client/ui-primitives/src/HoverCard.tsx b/packages/client/ui-primitives/src/HoverCard.tsx index 3b3ab47656..a4b928072a 100644 --- a/packages/client/ui-primitives/src/HoverCard.tsx +++ b/packages/client/ui-primitives/src/HoverCard.tsx @@ -159,6 +159,10 @@ export function HoverCard({ const wrapper = rootRef.current /* v8 ignore next -- the ref is attached before the layout effect runs and the listeners die with it. */ if (wrapper === null) return + if (wrapper.closest('[inert], [hidden]') !== null) { + dismissImmediately() + return + } const r = wrapper.getBoundingClientRect() const h = cardRef.current?.offsetHeight ?? 0 if (variant === 'preview') { @@ -197,6 +201,11 @@ export function HoverCard({ setPos({ left: r.right + ANCHOR_GAP, top }) } place() + // Observe only the anchor's ancestors: an offscreen drawer can hide without resizing its retained row. + const visibility = new MutationObserver(place) + for (let ancestor = rootRef.current?.parentElement; ancestor != null; ancestor = ancestor.parentElement) { + visibility.observe(ancestor, { attributes: true, attributeFilter: ['inert', 'hidden'] }) + } const observer = (variant === 'preview' || inline) && typeof ResizeObserver !== 'undefined' ? new ResizeObserver(place) : null for (const element of [cardRef.current, rootRef.current, widthAnchorRef?.current]) { if (element !== null && element !== undefined) observer?.observe(element) @@ -205,10 +214,11 @@ export function HoverCard({ window.addEventListener('resize', place) return () => { observer?.disconnect() + visibility.disconnect() window.removeEventListener('scroll', place, true) window.removeEventListener('resize', place) } - }, [open, variant, widthAnchorRef, positioned, inline]) + }, [open, variant, widthAnchorRef, positioned, inline, dismissImmediately]) // The first placement ran before the card mounted (height read 0): once the // card's real height is measurable, correct the bottom-edge clamp. The diff --git a/packages/client/ui-primitives/tests/hover-card.client.spec.tsx b/packages/client/ui-primitives/tests/hover-card.client.spec.tsx index e1f76fcd4b..50be572916 100644 --- a/packages/client/ui-primitives/tests/hover-card.client.spec.tsx +++ b/packages/client/ui-primitives/tests/hover-card.client.spec.tsx @@ -96,6 +96,22 @@ describe('HoverCard', () => { expect(screen.getByRole('tooltip').textContent).toBe('Details') }) + it.each(['inert', 'hidden'])('dismisses a portal when its retained anchor ancestor becomes %s', async (attribute) => { + const view = render(
row} content={
card body
} />
) + const row = screen.getByText('row') + const wrapper = row.parentElement! + fireEvent.pointerEnter(wrapper) + act(() => { vi.advanceTimersByTime(500) }) + expect(screen.getByText('card body')).toBeTruthy() + await act(async () => { view.container.firstElementChild!.setAttribute(attribute, '') }) + expect(screen.queryByText('card body')).toBeNull() + expect(screen.getByText('row')).toBe(row) + view.container.firstElementChild!.removeAttribute(attribute) + fireEvent.pointerEnter(wrapper) + act(() => { vi.advanceTimersByTime(500) }) + expect(screen.getByText('card body')).toBeTruthy() + }) + it('opens after the dwell delay, positioned right of the anchor', () => { const { wrapper } = mount() fireEvent.pointerEnter(wrapper) diff --git a/packages/client/ui-sidebar-right/src/client/shell/SidebarRight.module.css b/packages/client/ui-sidebar-right/src/client/shell/SidebarRight.module.css index 2924908ec3..7cfa701789 100644 --- a/packages/client/ui-sidebar-right/src/client/shell/SidebarRight.module.css +++ b/packages/client/ui-sidebar-right/src/client/shell/SidebarRight.module.css @@ -157,7 +157,7 @@ @media (pointer: coarse) { /* Retain the footprint so hiding the control cannot change its room measurement. */ - .panelBody :global(span:has(> [data-dockkit-split-blocked])) { + .panelBody :global([data-dockkit-split-control]:has(> [data-dockkit-split-blocked])) { visibility: hidden; } } diff --git a/packages/client/ui-sidebar/README.i18n.yaml b/packages/client/ui-sidebar/README.i18n.yaml index 0de9bd4d14..890958bc46 100644 --- a/packages/client/ui-sidebar/README.i18n.yaml +++ b/packages/client/ui-sidebar/README.i18n.yaml @@ -15,8 +15,8 @@ en: d152484eb41ac6b4 zh: 09388d293f9be9cb /deepseek-ai-dsh-client-ui-sidebar/use-this-package: - en: abeb2c660306846e - zh: 807296f5830a60ea + en: 90255789ba8051e5 + zh: 8fa1d34539f58e2e /deepseek-ai-dsh-client-ui-sidebar/use-this-package/brand-and-new-session: en: e68a91220fd47f98 zh: 531277d0fc42767f diff --git a/packages/client/ui-sidebar/README.md b/packages/client/ui-sidebar/README.md index 2776a5899d..5a77131338 100644 --- a/packages/client/ui-sidebar/README.md +++ b/packages/client/ui-sidebar/README.md @@ -29,7 +29,7 @@ The dsh web client sidebar lets users recognize the active build, start a new se The sidebar is the navigation shell: users see the brand, start new sessions, collapse the rail, and reach Settings. Feature plugins fill its seats — ui-workspace fills `sidebar.workspaces`, ui-settings registers the trigger row and settings panel at `sidebar.settings`. -Below 768px, without a native Windows caption, the sidebar keeps its expanded content mounted inside the frame's drawer. The drawer traps keyboard focus, closes with Escape or a mask press, and restores the invoking control unless a foreground dialog remains open. When an open drawer becomes a collapsed rail, focus transfers to the rail toggle if the invoking control unmounts and focus remains in the sidebar. Returning from a closed drawer renders the compact rail immediately, without a crossfade. Its toggle tooltip renders outside the drawer. Opening it does not resize the conversation. +Below 768px, without a native Windows caption, the sidebar keeps its expanded content mounted inside the frame's drawer. The drawer initially focuses its collapse toggle, traps keyboard focus, closes with Escape or a mask press, and restores the invoking control unless a foreground dialog remains open. When an open drawer becomes a collapsed rail, focus transfers to the rail toggle if the invoking control unmounts and focus remains in the sidebar. Returning from a closed drawer renders the compact rail immediately, without a crossfade. Its toggle tooltip renders outside the drawer. Opening it does not resize the conversation. ### Brand and New Session diff --git a/packages/client/ui-sidebar/README.zh.md b/packages/client/ui-sidebar/README.zh.md index 42ad612625..81581e455a 100644 --- a/packages/client/ui-sidebar/README.zh.md +++ b/packages/client/ui-sidebar/README.zh.md @@ -29,7 +29,7 @@ dsh Web 客户端的侧边栏让用户识别当前构建、启动新会话、将 侧边栏是导航外壳:用户看到品牌、启动新会话、折叠轨道并到达 Settings。功能插件填充它的席位——ui-workspace 填充 `sidebar.workspaces`,ui-settings 在 `sidebar.settings` 注册触发行与设置面板。 -宽度低于 768px 且没有原生 Windows 顶栏时,侧边栏在框架抽屉内保留展开内容。抽屉限制键盘焦点范围,支持 Escape 和点击蒙层关闭,并在没有上层弹窗时将焦点还给打开它的控件。打开的抽屉切换为收起图标栏时,若打开入口已卸载且焦点仍在侧栏内,焦点转交给图标栏开关。关闭的抽屉切回图标栏时,立即使用紧凑布局,不播放交叉淡入淡出。开关的提示气泡在抽屉外渲染。打开抽屉不改变会话宽度。 +宽度低于 768px 且没有原生 Windows 顶栏时,侧边栏在框架抽屉内保留展开内容。抽屉首先聚焦收起按钮,并限制键盘焦点范围,支持 Escape 和点击蒙层关闭,并在没有上层弹窗时将焦点还给打开它的控件。打开的抽屉切换为收起图标栏时,若打开入口已卸载且焦点仍在侧栏内,焦点转交给图标栏开关。关闭的抽屉切回图标栏时,立即使用紧凑布局,不播放交叉淡入淡出。开关的提示气泡在抽屉外渲染。打开抽屉不改变会话宽度。 ### 品牌与 New Session diff --git a/packages/client/ui-sidebar/src/client/SidebarRoot.tsx b/packages/client/ui-sidebar/src/client/SidebarRoot.tsx index 2da3170c16..d8616305f5 100644 --- a/packages/client/ui-sidebar/src/client/SidebarRoot.tsx +++ b/packages/client/ui-sidebar/src/client/SidebarRoot.tsx @@ -245,6 +245,7 @@ export function SidebarRoot({ + + } + const view = render() + view.rerender() + await act(async () => {}) + screen.getAllByRole('treeitem')[1]!.focus() + expect(screen.getByRole('button').tabIndex).toBe(-1) + view.rerender() + await waitFor(() => { expect(screen.getByRole('button').tabIndex).toBe(0) }) +}) + +it('updates one running row without traversing the remaining 199 rows', async () => { + function List({ running }: { running: boolean }) { + return {Array.from({ length: 200 }, (_, i) => +
{i === 100 && running ? Running : null}
, + )}
+ } + const view = render() + const scans = screen.getAllByRole('treeitem').map(row => vi.spyOn(row, 'querySelectorAll')) + view.rerender() + await act(async () => {}) + expect(screen.getByText('Running')).toBeTruthy() + expect(scans.filter(scan => scan.mock.calls.length > 0)).toHaveLength(1) + scans.forEach((scan) => { scan.mockRestore() }) +}) + +it('accepts focus during mounting and updates SVG and text children without changing the entry', async () => { + render( +
First
+
+
) + const [first, row] = screen.getAllByRole('treeitem') as [HTMLElement, HTMLElement] + await act(async () => { + screen.getByTestId('status').append(document.createElementNS('http://www.w3.org/2000/svg', 'path')) + row.append(document.createTextNode('Running')) + }) + expect(first.tabIndex).toBe(-1) + expect(row.tabIndex).toBe(0) + expect(screen.getByRole('button').tabIndex).toBe(0) + expect(document.activeElement).toBe(screen.getByRole('button')) +}) + +it('ignores action updates from a row removed in the same commit', async () => { + const view = render(list(['one', 'two'])) + const removed = screen.getAllByRole('treeitem')[1]! + act(() => { + removed.append(document.createElement('button')) + view.rerender(list(['one'])) + }) + await act(async () => {}) + expect(removed.isConnected).toBe(false) + expect(screen.getByRole('treeitem').tabIndex).toBe(0) + expect(screen.getByRole('button', { name: 'one actions' }).tabIndex).toBe(0) +}) + +it('keeps inactive actions reachable after StrictMode replays the layout effect', () => { + render({list(['one', 'two'])}) + screen.getAllByRole('treeitem')[1]!.focus() + expect(screen.getByRole('button', { name: 'two actions' }).tabIndex).toBe(0) + expect(screen.getByRole('button', { name: 'one actions' }).tabIndex).toBe(-1) +})