存量清理(首跑 141 errors / 21 warnings → 0 / 0): - 删除孤儿 disable:SideChatView / Sidebar / selection-popup 三处 exhaustive-deps 豁免与 chunk-artifact 的 no-new-func 豁免(多行理由注释把 disable-next-line 顶离了实报行;selection-popup 改为提取 popupOpen 标志真修复) - 死代码:未用导入(Sidebar×7、TextEditor、SideCardSection、config、fs-operations 及 6 个 spec)、sidechat-core 死累加器 total、chunk-loader.spec 死助手 registry、sidechat-seed-validation 死助手 toolResultMessage - 真实小修:agent-opens 三处 throw 补 cause;lazy-chunk any → ComponentType<P>(P extends object);service.ts claimed 初值改定值赋值;chunk-loader task / spec 内 etag / pendingLoad / snapshot 改 const;terminal-links 去掉字符类内多余转义;SubagentView catalogs 空兜底 useMemo 稳定标识;editor-host.spec 组件提出大写 FakeViewer(rules-of-hooks);pty-helpers.spec 内联 require 提升为静态导入;panel-host-css 注释里的零宽空格改为可见写法 - 依赖数组豁免(均带理由):granular scope 字段(EditorHost / PdfView / ChangesTab / GitLens×2)、job.status 粒度(SubagentView×2)、清理期读 ref、mount-only 注册等;ctx(挂载期恒定)直接入 deps(Sidebar×3)、TextEditor previewScroll 补 scope(幂等) - 刻意控制字符正则(conversation-draft / markdown-images)与宿主槽位 any 签名(context-types)以带理由豁免保留 接入: - Makefile:lint 目标(typecheck 旁),check 聚合补 lint 保持「对齐 CI」语义 - ci.yml ci / ci-windows 两 job 与 release.yml 在 Typecheck 后加 Lint 步骤(release 注释同步顺序)
48 lines
2.3 KiB
TypeScript
48 lines
2.3 KiB
TypeScript
/**
|
|
* The unified panel host layer must clip WITHOUT being a scroll container —
|
|
* the guard for the "panels / toggle cluster jumped away from the viewport
|
|
* corner" bug class.
|
|
*
|
|
* `overflow: hidden` only clips: the box stays a scroll container, so any
|
|
* script scroll or the browser's native scroll-into-view fixup (focus moving
|
|
* into an off-viewport region, a nested workbench/iframe claiming focus
|
|
* while it loads, focus() landing during a panel's slide-out transition)
|
|
* walks up to the nearest scrollable ancestor — this layer — and scrolls it,
|
|
* dragging every panel plus the toggle cluster off the corner while the
|
|
* computed `left`/`right` still read correct (the offset hides in the box's
|
|
* own scroll offset). `overflow: clip` declared AFTER `hidden` keeps the
|
|
* `hidden` fallback for engines without clip support and removes the
|
|
* scrollability everywhere else; the cascade order is part of the contract.
|
|
*/
|
|
import { readFileSync } from 'node:fs'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const css = readFileSync('src/client/sidebar.module.css', 'utf8')
|
|
|
|
/** Body of the `:global([data-dsh-panel-host])` rule (up to the un-indented `}`). */
|
|
const hostRule = css.match(/:global\(\[data-dsh-panel-host\]\) \{([\s\S]*?)\n\}/)?.[1]
|
|
|
|
/** Strip block comments (`/*` to `*`-`/`) so prose mentions don't count as declarations. */
|
|
const stripComments = (cssText: string): string => cssText.replace(/\/\*[\s\S]*?\*\//g, '')
|
|
|
|
describe('panel host layer css', () => {
|
|
it('declares the clip cascade: hidden first, clip last', () => {
|
|
expect(hostRule, 'the [data-dsh-panel-host] rule must exist').toBeDefined()
|
|
const declarations = stripComments(hostRule!).match(/overflow\s*:\s*\w+/g) ?? []
|
|
expect(declarations).toEqual(['overflow: hidden', 'overflow: clip'])
|
|
})
|
|
|
|
it('stays the fixed viewport layer (containing block + BFC guarantee)', () => {
|
|
expect(hostRule).toMatch(/position:\s*fixed/)
|
|
expect(hostRule).toMatch(/inset:\s*0/)
|
|
})
|
|
|
|
it('does not reintroduce overflow on the degraded (absolute) layer', () => {
|
|
const degraded = css.match(
|
|
/:global\(\[data-dsh-panel-host\]\[data-dsh-panel-host-degraded\]\) \{([\s\S]*?)\n\}/,
|
|
)?.[1]
|
|
expect(degraded, 'the degraded-mode rule must exist').toBeDefined()
|
|
expect(degraded).not.toMatch(/overflow\s*:/)
|
|
})
|
|
})
|