fix(ui): keep invisible dock separators clear during pointer resize

This commit is contained in:
Codex
2026-11-15 11:36:29 +03:00
parent 70d5d8b385
commit 8b49296efa
5 changed files with 13 additions and 4 deletions
+1 -1
View File
@@ -1616,7 +1616,7 @@ export function CatalogApp() {
</div> </div>
<p className="catalog-preview__explanation">Rectangle, maximize, close и stacking остаются состоянием приложения; дизайн-система владеет одинаковой bounded-геометрией и доступным управлением.</p> <p className="catalog-preview__explanation">Rectangle, maximize, close и stacking остаются состоянием приложения; дизайн-система владеет одинаковой bounded-геометрией и доступным управлением.</p>
</Preview> </Preview>
<Preview title="Split pane" note="pointer / keyboard / controlled" className="catalog-preview--wide catalog-split-pane-preview"> <Preview title="Split pane" note="pointer resize: invisible / keyboard focus: visible" className="catalog-preview--wide catalog-split-pane-preview">
<Switch label="Скрыть линию разделителя" checked={splitPaneInvisible} onChange={setSplitPaneInvisible} /> <Switch label="Скрыть линию разделителя" checked={splitPaneInvisible} onChange={setSplitPaneInvisible} />
<div className="catalog-split-pane-demo"> <div className="catalog-split-pane-demo">
<SplitPane <SplitPane
+2
View File
@@ -185,6 +185,8 @@ ConfirmationModal оборачивает Window и защищает async-confir
## SplitPane ## SplitPane
Невидимый разделитель остаётся прозрачным при наведении и pointer-resize, даже после ввода в текстовом поле. Клавиатурное изменение размера сохраняет видимый focus cue.
`SplitPane` — контролируемая раскладка двух синхронных представлений с общей регулируемой границей. Приложение передаёт содержимое обеих панелей, процент primary-панели и callback изменения; дизайн-система владеет pointer capture, ограничениями размеров, focus-state и доступностью `role="separator"`. `SplitPane` — контролируемая раскладка двух синхронных представлений с общей регулируемой границей. Приложение передаёт содержимое обеих панелей, процент primary-панели и callback изменения; дизайн-система владеет pointer capture, ограничениями размеров, focus-state и доступностью `role="separator"`.
Локальные toolbar и overlay каждого viewport являются содержимым соответствующей панели. Их нельзя позиционировать от общего workspace или вычислять по cursor/event-эвристике вложенного renderer. Если renderer хранит свою раскладку, приложение передаёт ему тот же controlled процент из `SplitPane`, чтобы renderer и локальный UI использовали одну геометрию. Локальные toolbar и overlay каждого viewport являются содержимым соответствующей панели. Их нельзя позиционировать от общего workspace или вычислять по cursor/event-эвристике вложенного renderer. Если renderer хранит свою раскладку, приложение передаёт ему тот же controlled процент из `SplitPane`, чтобы renderer и локальный UI использовали одну геометрию.
+3 -1
View File
@@ -3169,7 +3169,9 @@ textarea.nodedc-field__control {
} }
/* Keep the full hit area and keyboard focus cue without a visible divider. */ /* Keep the full hit area and keyboard focus cue without a visible divider. */
.nodedc-split-pane[data-separator-appearance="invisible"] > .nodedc-split-pane__separator:not(:focus-visible)::before { .nodedc-split-pane[data-separator-appearance="invisible"] > .nodedc-split-pane__separator:not(:focus-visible)::before,
.nodedc-split-pane[data-separator-appearance="invisible"] > .nodedc-split-pane__separator[data-pointer-focus]::before,
.nodedc-split-pane[data-separator-appearance="invisible"][data-dragging="true"] > .nodedc-split-pane__separator::before {
background: transparent; background: transparent;
box-shadow: none; box-shadow: none;
} }
+6 -1
View File
@@ -57,6 +57,7 @@ export function SplitPane({
const rootRef = useRef<HTMLDivElement>(null); const rootRef = useRef<HTMLDivElement>(null);
const activePointerIdRef = useRef<number | null>(null); const activePointerIdRef = useRef<number | null>(null);
const [dragging, setDragging] = useState(false); const [dragging, setDragging] = useState(false);
const [pointerFocus, setPointerFocus] = useState(false);
const limits = normalizedLimits(minPrimarySize, minSecondarySize); const limits = normalizedLimits(minPrimarySize, minSecondarySize);
const size = clamp(Number.isFinite(primarySize) ? primarySize : 50, limits.minimum, limits.maximum); const size = clamp(Number.isFinite(primarySize) ? primarySize : 50, limits.minimum, limits.maximum);
const keyboardIncrement = Number.isFinite(step) && step > 0 ? step : 2; const keyboardIncrement = Number.isFinite(step) && step > 0 ? step : 2;
@@ -74,6 +75,7 @@ export function SplitPane({
}; };
const handleKeyDown = (event: KeyboardEvent<HTMLElement>) => { const handleKeyDown = (event: KeyboardEvent<HTMLElement>) => {
setPointerFocus(false);
const multiplier = event.shiftKey ? 5 : 1; const multiplier = event.shiftKey ? 5 : 1;
const decrement = orientation === "vertical" ? "ArrowLeft" : "ArrowUp"; const decrement = orientation === "vertical" ? "ArrowLeft" : "ArrowUp";
const increment = orientation === "vertical" ? "ArrowRight" : "ArrowDown"; const increment = orientation === "vertical" ? "ArrowRight" : "ArrowDown";
@@ -119,10 +121,13 @@ export function SplitPane({
aria-valuemax={Math.round(limits.maximum)} aria-valuemax={Math.round(limits.maximum)}
aria-valuenow={Math.round(size)} aria-valuenow={Math.round(size)}
aria-valuetext={`${Math.round(size)}% / ${Math.round(100 - size)}%`} aria-valuetext={`${Math.round(size)}% / ${Math.round(100 - size)}%`}
data-pointer-focus={pointerFocus || undefined}
onBlur={() => setPointerFocus(false)}
onKeyDown={handleKeyDown} onKeyDown={handleKeyDown}
onPointerDown={(event) => { onPointerDown={(event) => {
if (event.button !== 0) return; if (event.button !== 0) return;
event.currentTarget.focus(); setPointerFocus(true);
event.currentTarget.focus({ preventScroll: true });
activePointerIdRef.current = event.pointerId; activePointerIdRef.current = event.pointerId;
event.currentTarget.setPointerCapture(event.pointerId); event.currentTarget.setPointerCapture(event.pointerId);
setDragging(true); setDragging(true);
+1 -1
View File
@@ -547,7 +547,7 @@
"behavior": [ "behavior": [
"controlled percentage", "controlled percentage",
"optional resizable separator", "optional resizable separator",
"line or invisible separator appearance with retained keyboard focus", "line or invisible separator appearance with retained keyboard focus; pointer resize never paints the invisible divider",
"pointer capture drag", "pointer capture drag",
"Arrow/Home/End keyboard sizing", "Arrow/Home/End keyboard sizing",
"ARIA separator range", "ARIA separator range",