merge #1012: fix(float): 浮窗右下角缩放手柄不再被 tab 内容压住
This commit is contained in:
commit
042ae22bf4
3 files changed
+66
-2
No files matched your search
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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*:/)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user