Merge pull request #8518 from deepseek-harness/turtle/fix-sidebar-scroll-c22e7e84e865
fix(sidebar-right): scroll the Start guide in a short pane
This commit is contained in:
commit
e65560503a
6 files changed
+35
-12
No files matched your search
@@ -496,6 +496,25 @@ describe('web e2e: shipped right Sidebar', () => {
|
||||
expect(await filesTab.locator('[data-dockkit-tab-close]').count()).toBe(1)
|
||||
const guideTab = column.locator('[data-dockkit-tab]').filter({ hasText: 'Start' })
|
||||
expect(await guideTab.locator('[data-dockkit-tab-close]').count()).toBe(1)
|
||||
// A pane shorter than the guide scrolls it from the compass to the last capsule.
|
||||
const viewport = page.viewportSize()
|
||||
if (viewport === null) throw new Error('expected a fixed viewport')
|
||||
const guide = column.locator('[data-sidebar-right-guide]')
|
||||
await page.setViewportSize({ width: viewport.width, height: 240 })
|
||||
try {
|
||||
await expect.poll(async () => await guide.evaluate(node => node.scrollHeight > node.clientHeight)).toBe(true)
|
||||
expect(await guide.evaluate(node => node.scrollTop)).toBe(0)
|
||||
const lastEntry = guide.locator('[data-sidebar-right-guide-entry]').last()
|
||||
await guide.evaluate((node) => { node.scrollTop = node.scrollHeight })
|
||||
expect(await guide.evaluate(node => node.scrollTop)).toBeGreaterThan(0)
|
||||
expect(await lastEntry.evaluate((node) => {
|
||||
const entry = node.getBoundingClientRect()
|
||||
const pane = node.closest('[data-sidebar-right-guide]')?.getBoundingClientRect()
|
||||
return pane !== undefined && entry.top >= pane.top && entry.bottom <= pane.bottom
|
||||
})).toBe(true)
|
||||
} finally {
|
||||
await page.setViewportSize(viewport)
|
||||
}
|
||||
// Back to the seeded shape the cases below start from.
|
||||
await guideTab.hover()
|
||||
await guideTab.locator('[data-dockkit-tab-close]').click()
|
||||
|
||||
@@ -36,8 +36,8 @@
|
||||
en: b6c64c7649203e12
|
||||
zh: c9341bbfd548a5eb
|
||||
/deepseek-ai-dsh-client-ui-sidebar-right/the-guide:
|
||||
en: 68fd575ef382223e
|
||||
zh: 1ab1653ee20c64e9
|
||||
en: 2cc38fa6666dbc17
|
||||
zh: 1063018c8fe95012
|
||||
/deepseek-ai-dsh-client-ui-sidebar-right/copy:
|
||||
en: 67386560b71672a4
|
||||
zh: 35cf8cb7ddf618ce
|
||||
|
||||
@@ -126,7 +126,7 @@ A tab type can declare `multiple: true` for independent instances such as termin
|
||||
|
||||
Default pages depend on the number of registered guide entries, not tab types or open tabs. Exactly one entry opens its page directly; zero or multiple entries open the guide. Explicitly adding a guide always opens the guide. Closing follows the [sole-docked-tab rule](#state).
|
||||
|
||||
The guide tab is a muted compass over one entry capsule per `guide` entry the registered types contributed, in `order`, centred in the body; the guide has no words of its own. A capsule shows the entry's glyph — or the guide's quieter cube placeholder when the entry registered none — and its title; while at most four entries are listed, an entry that registered a `description` shows it under the title, and a longer list drops every description. Picking a default capsule or a **More tools** row calls `tab.actions.openTab(entry.kind, { replaceTab: true })` and then `tab.actions.close()`, so the guide gives way to the page it opened and closes itself when that page was revealed; the open-page shortcut from a focused guide does the same. A pane holds at most one guide tab. The strip's add control is drawn only while its pane holds none and opens one there with `openTab('guide', { paneId, revealIfOpened: false })`, so a guide in another pane does not capture the click; opening the guide into a pane that already has one focuses it instead; a guide dragged, dropped, or docked into such a pane merges into it — the arriving guide closes and the pane's own is focused; `duplicateTab` on the guide records nothing. A split, an expanded empty root pane, and the pane a sole tab vacates by dropping on its own edge use the same default-page rule, one tab per new pane; the self-edge drop leaves the dragged tab focused. A plain `openTab('guide')` opens or focuses the guide only within the active or named pane. Splitting an empty pane does nothing and returns no new pane. The product allows two horizontal panes, initially equal, with divider ratios limited to 20%–80%. Insufficient width blocks a new split; with two panes already present, a body drop moves the tab between panes instead of creating a third. At the two-pane limit, split controls are disabled with a focusable reason; closing back to one pane enables them.
|
||||
The guide tab is a muted compass over one entry capsule per `guide` entry the registered types contributed, in `order`, centred in the body; a guide taller than its pane starts at the top and scrolls. The guide has no words of its own. A capsule shows the entry's glyph — or the guide's quieter cube placeholder when the entry registered none — and its title; while at most four entries are listed, an entry that registered a `description` shows it under the title, and a longer list drops every description. Picking a default capsule or a **More tools** row calls `tab.actions.openTab(entry.kind, { replaceTab: true })` and then `tab.actions.close()`, so the guide gives way to the page it opened and closes itself when that page was revealed; the open-page shortcut from a focused guide does the same. A pane holds at most one guide tab. The strip's add control is drawn only while its pane holds none and opens one there with `openTab('guide', { paneId, revealIfOpened: false })`, so a guide in another pane does not capture the click; opening the guide into a pane that already has one focuses it instead; a guide dragged, dropped, or docked into such a pane merges into it — the arriving guide closes and the pane's own is focused; `duplicateTab` on the guide records nothing. A split, an expanded empty root pane, and the pane a sole tab vacates by dropping on its own edge use the same default-page rule, one tab per new pane; the self-edge drop leaves the dragged tab focused. A plain `openTab('guide')` opens or focuses the guide only within the active or named pane. Splitting an empty pane does nothing and returns no new pane. The product allows two horizontal panes, initially equal, with divider ratios limited to 20%–80%. Insufficient width blocks a new split; with two panes already present, a body drop moves the tab between panes instead of creating a third. At the two-pane limit, split controls are disabled with a focusable reason; closing back to one pane enables them.
|
||||
|
||||
<a id="copy"></a>
|
||||
## Copy
|
||||
|
||||
@@ -126,7 +126,7 @@ root 作用域的 `sidebar.right.tab.guide.actions` list 有注册项时,引
|
||||
|
||||
默认页取决于已注册的引导入口数,不取决于 tab 类型数或已打开的 tab 数。恰好一个入口时直接打开对应页面;没有入口或有多个入口时打开引导页。显式添加引导页始终打开引导页。关闭遵循[唯一停靠 tab 规则](#state)。
|
||||
|
||||
引导 tab 是一枚弱化的罗盘,下方是各已注册类型贡献的每个 `guide` 条目一个入口胶囊,按 `order` 排列并在正文中居中;引导页自己没有文字。胶囊显示条目的图标——条目没注册图标时用引导页自己更浅的立方体占位符——和标题;列出的条目不超过四个时,注册了 `description` 的条目在标题下显示它,更长的列表则去掉所有描述。点击默认胶囊或**更多工具**菜单行会调用 `tab.actions.openTab(entry.kind, { replaceTab: true })`,再调用 `tab.actions.close()`,于是引导页让位给它打开的页,该页被揭示时引导页关闭自己;在聚焦的引导页上用快捷键打开页时也是如此。一个格最多持有一个引导 tab。tab 条的添加控件只在该格没有引导 tab 时绘制,并以 `openTab('guide', { paneId, revealIfOpened: false })` 在该格打开一个,这样别的格里的引导页不会截走这次点击;把引导页开进已有引导页的格则改为聚焦它;把引导页拖入、放入或收回到这样的格会合并进去——来者关闭,该格自己的被聚焦;对引导页 `duplicateTab` 不记录任何东西。分栏、展开且为空的根格、以及唯一 tab 拖到本格边缘分屏后腾出的格使用相同的默认页规则,每个新格一个 tab;这种本格边缘拖放让被拖的 tab 保持聚焦。普通的 `openTab('guide')` 只在活跃或指定分栏内打开或聚焦引导页。对空分栏执行 split 不产生变化,也不返回新分栏。产品最多保留左右两格,默认均分,分隔条限定在 20%~80%。宽度不足以容纳两格时不允许新分栏;已有两格时,正文拖放用于跨格移动,不再创建第三格。达到两格上限时禁用分栏控件并提供可聚焦的原因提示;关闭回单格后重新启用。
|
||||
引导 tab 是一枚弱化的罗盘,下方是各已注册类型贡献的每个 `guide` 条目一个入口胶囊,按 `order` 排列并在正文中居中;引导页高于所在格时从顶部开始排列并可滚动。引导页自己没有文字。胶囊显示条目的图标——条目没注册图标时用引导页自己更浅的立方体占位符——和标题;列出的条目不超过四个时,注册了 `description` 的条目在标题下显示它,更长的列表则去掉所有描述。点击默认胶囊或**更多工具**菜单行会调用 `tab.actions.openTab(entry.kind, { replaceTab: true })`,再调用 `tab.actions.close()`,于是引导页让位给它打开的页,该页被揭示时引导页关闭自己;在聚焦的引导页上用快捷键打开页时也是如此。一个格最多持有一个引导 tab。tab 条的添加控件只在该格没有引导 tab 时绘制,并以 `openTab('guide', { paneId, revealIfOpened: false })` 在该格打开一个,这样别的格里的引导页不会截走这次点击;把引导页开进已有引导页的格则改为聚焦它;把引导页拖入、放入或收回到这样的格会合并进去——来者关闭,该格自己的被聚焦;对引导页 `duplicateTab` 不记录任何东西。分栏、展开且为空的根格、以及唯一 tab 拖到本格边缘分屏后腾出的格使用相同的默认页规则,每个新格一个 tab;这种本格边缘拖放让被拖的 tab 保持聚焦。普通的 `openTab('guide')` 只在活跃或指定分栏内打开或聚焦引导页。对空分栏执行 split 不产生变化,也不返回新分栏。产品最多保留左右两格,默认均分,分隔条限定在 20%~80%。宽度不足以容纳两格时不允许新分栏;已有两格时,正文拖放用于跨格移动,不再创建第三格。达到两格上限时禁用分栏控件并提供可聚焦的原因提示;关闭回单格后重新启用。
|
||||
|
||||
<a id="copy"></a>
|
||||
## 文案
|
||||
|
||||
@@ -2,23 +2,26 @@
|
||||
stylesheet does not carry them. Tokens only. */
|
||||
|
||||
/* The capsules form one centred column at the column's own 14px gap, lifted
|
||||
above the body's middle by the spacer below. The minimum height centres a
|
||||
short guide while allowing a tall guide to grow into the pane's scroller. */
|
||||
above the body's middle by the spacer below. The guide fills the tab body,
|
||||
which clips, and scrolls itself; `safe` centring starts a guide taller than
|
||||
the pane at its top so every capsule stays reachable. The block padding
|
||||
keeps a scrolled-to-end capsule's focus ring off the pane's edge. */
|
||||
.guide {
|
||||
--dsl-guide-entry-radius: var(--dsw-radius-xl);
|
||||
display: flex;
|
||||
flex: 1 1 auto;
|
||||
flex-direction: column;
|
||||
gap: 14px;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
justify-content: safe center;
|
||||
box-sizing: border-box;
|
||||
min-height: 100%;
|
||||
padding: 0 24px;
|
||||
padding: 14px 24px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* The lift, as a share of the pane's height (a column flex basis resolves
|
||||
against it): the centred column rises 5% of the pane, and a short pane
|
||||
gives it up before the capsules clip. */
|
||||
gives it up before the column overflows. */
|
||||
.guide::after {
|
||||
content: '';
|
||||
flex: 0 1 10%;
|
||||
|
||||
@@ -9,8 +9,9 @@
|
||||
* cannot be outvoted by accident.
|
||||
*
|
||||
* The shipped guide is a muted compass over the pinned entry capsules every
|
||||
* registered type contributed, centred in the body, with no heading, as a
|
||||
* browser start page shows its doors without a caption. While at most four
|
||||
* registered type contributed, centred in the body (scrolling from the top when
|
||||
* taller than the pane), with no heading, as a browser start page shows its
|
||||
* doors without a caption. While at most four
|
||||
* capsules are visible, a capsule with a description shows it under the title;
|
||||
* a longer list drops every description to stay light. A More card follows
|
||||
* while `sidebar.right.tab.guide.actions` has registrations.
|
||||
|
||||
Reference in new issue
Block a user