From 9bece137e17095a7f868aff1860dac52d4388ba0 Mon Sep 17 00:00:00 2001 From: ymac <707337118@qq.com> Date: Mon, 19 Oct 2026 23:17:03 +0800 Subject: [PATCH] =?UTF-8?q?fix(float):=20=E5=AE=BF=E4=B8=BB=E7=BC=A9?= =?UTF-8?q?=E6=94=BE=E6=89=8B=E6=9F=84=E4=B8=8D=E5=86=8D=E8=A2=AB=20tab=20?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E5=8E=8B=E4=BD=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 浮动 Git tab 的右下角 20×20 手柄([data-dockkit-float-resize])是浮窗的 最后一个子节点,但宿主给它 z-index: auto;Git footer 的 sticky + z-index:1 正好盖在角上,手柄既看不见也点不到,整个浮窗无法用指针缩放。实测文件 tab 的浮窗正常(底部没有 stacking 栏),只有带底栏的 tab 中招。 - 把宿主手柄抬到 z-index:2:覆盖第三方 tab 内容,不依赖插件自己的底栏; - 收掉 .gitFooter 的 z-index:sticky + 定位已足够压在滚动行之上,这一层 在没有该宿主属性的版本上也成立; - tests/float-resize-grip.spec.ts 钉住两条(含 z-index 必须 > 1)。 --- src/client/changes/changes.module.css | 8 +++-- src/client/sidebar.module.css | 14 ++++++++ tests/float-resize-grip.spec.ts | 46 +++++++++++++++++++++++++++ 3 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 tests/float-resize-grip.spec.ts diff --git a/src/client/changes/changes.module.css b/src/client/changes/changes.module.css index e4b4b2c9..b45d2b37 100644 --- a/src/client/changes/changes.module.css +++ b/src/client/changes/changes.module.css @@ -62,8 +62,12 @@ /* Docked by the flex column above (a sibling of `.gitScroll`), plus sticky so it also survives the case where the host tab body itself scrolls the whole - tab — the branch control must never leave the bottom of the pane. */ -.gitFooter { flex: none; min-width: 0; position: sticky; bottom: 0; z-index: 1; border-top: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-base); } + tab — the branch control must never leave the bottom of the pane. + NO z-index: in a floating window the host's resize grip is the last child + at `z-index: auto`, so a stacking footer paints over the bottom-right + corner and makes the grip un-hittable. Sticky (positioned) already paints + above the scrolled rows. */ +.gitFooter { flex: none; min-width: 0; position: sticky; bottom: 0; border-top: 1px solid var(--dsw-alias-border-l1); background: var(--dsw-alias-bg-base); } .footerRow { display: flex; align-items: center; min-width: 0; min-height: 28px; } /* A failed remote op reports above the branch row and git's stderr can be long: diff --git a/src/client/sidebar.module.css b/src/client/sidebar.module.css index 96c30035..b93ec2f7 100644 --- a/src/client/sidebar.module.css +++ b/src/client/sidebar.module.css @@ -109,6 +109,20 @@ -webkit-app-region: no-drag; } +/* The host float window's resize grip (`data-dockkit-float-resize`, the + 20×20 bottom-right corner) is the float's LAST child but sits at + `z-index: auto`. Tab content we do not control the stacking of may paint + above it at z-index 1 — the Git footer and the explorer's multi-select bar + both do — which made the grip invisible AND un-hittable: a floating Git tab + could not be resized by pointer at all, while the file tab's float (no + stacking bottom bar) resized normally. Raise the host's own hook above that + class of content; this is the half that also covers third-party tab + content we do not own (the content-side cleanup is .gitFooter dropping its + own z-index in changes.module.css). */ +:global([data-dockkit-float-resize]) { + z-index: 2; +} + :global([data-dsh-panel-host][data-dsh-panel-host-degraded]) { position: absolute; top: 0; diff --git a/tests/float-resize-grip.spec.ts b/tests/float-resize-grip.spec.ts new file mode 100644 index 00000000..f3a0562d --- /dev/null +++ b/tests/float-resize-grip.spec.ts @@ -0,0 +1,46 @@ +/** + * A floating tab must be resizable by pointer. + * + * The host renders the float's 20×20 resize grip (`data-dockkit-float-resize`) + * as its LAST child but at `z-index: auto`. Tab content that stacks above it + * takes the bottom-right corner away from the grip: on the real app a + * floating Git tab could not be resized at all (its footer is + * `position: sticky; z-index: 1`), while a floating file tab — whose bottom + * edge carries no stacking bar — resized normally. The failure is silent: + * the corner glyph never appears and the cursor never becomes `nwse-resize`. + * + * Two guards: the host hook is raised above that class of content (also + * covering third-party tab bodies we do not own), and the Git footer no + * longer stacks on its own, so the grip wins even on a host build without the + * attribute hook. + */ +import { readFileSync } from 'node:fs' +import { describe, expect, it } from 'vitest' + +/** Strip block comments so prose mentions are not read as declarations. */ +const stripComments = (text: string): string => text.replace(/\/\*[\s\S]*?\*\//g, '') + +const shellCss = stripComments(readFileSync('src/client/sidebar.module.css', 'utf8')) +const changesCss = stripComments(readFileSync('src/client/changes/changes.module.css', 'utf8')) + +describe('floating tab resize grip', () => { + it('raises the host grip above content that stacks at z-index 1', () => { + const rule = shellCss.match(/:global\(\[data-dockkit-float-resize\]\)\s*\{([^}]*)\}/)?.[1] + expect(rule, 'the [data-dockkit-float-resize] global rule must exist').toBeDefined() + const zIndex = Number(rule!.match(/z-index:\s*(\d+)/)?.[1]) + // The Git footer used to stack at 1; anything <= 1 leaves it covering the + // grip again. Pin "above 1" rather than the exact literal so a future + // host/content z-index bump can move the value without re-breaking this. + expect(Number.isFinite(zIndex)).toBe(true) + expect(zIndex).toBeGreaterThan(1) + }) + + it('keeps the Git footer from stacking over the grip', () => { + const footer = changesCss.match(/\.gitFooter\s*\{([^}]*)\}/)?.[1] + expect(footer, 'the .gitFooter rule must exist').toBeDefined() + // Sticky stays: the footer must survive the host tab body scrolling. + expect(footer).toMatch(/position:\s*sticky/) + expect(footer).toMatch(/bottom:\s*0/) + expect(footer).not.toMatch(/(?:^|[;\s])z-index\s*:/) + }) +})