fix(web): address review feedback on the monitoring column (#1616)
- ResizeHandle: clear the `resizing-col` body class on unmount so a drag
interrupted by the handle unmounting (narrow past the breakpoint / disconnect)
can't leave page-wide user-select:none / col-resize applied.
- Embedded monitor column now shows the full unfiltered stream instead of
silently mirroring the full-size screen's live filter (the column has no
filter control to explain an empty/partial list).
- MonitoringControls: give the SegmentedControl an aria-label ("Monitoring
screen") so the tab group has an accessible name.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
daf736c6e7
commit
9b76272ad1
2 changed files with 124 additions and 11 deletions
|
|
@ -86,6 +86,28 @@ describe("ResizeHandle", () => {
|
|||
expect(document.body.classList.contains("resizing-col")).toBe(false);
|
||||
});
|
||||
|
||||
it("clears the drag body class if it unmounts mid-drag", () => {
|
||||
const onChange = vi.fn();
|
||||
const onCommit = vi.fn();
|
||||
const { unmount } = renderWithMantine(
|
||||
<ResizeHandle
|
||||
value={400}
|
||||
min={320}
|
||||
max={720}
|
||||
onChange={onChange}
|
||||
onCommit={onCommit}
|
||||
/>,
|
||||
);
|
||||
fireEvent.pointerDown(screen.getByRole("separator"), {
|
||||
clientX: 500,
|
||||
pointerId: 1,
|
||||
});
|
||||
expect(document.body.classList.contains("resizing-col")).toBe(true);
|
||||
// No pointerup/cancel — the handle is removed from the tree first.
|
||||
unmount();
|
||||
expect(document.body.classList.contains("resizing-col")).toBe(false);
|
||||
});
|
||||
|
||||
it("ignores pointer moves when no drag is active", () => {
|
||||
const { handle, onChange, onCommit } = setup();
|
||||
fireEvent.pointerMove(handle, { clientX: 460, pointerId: 1 });
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
import { useRef, type KeyboardEvent, type PointerEvent } from "react";
|
||||
import {
|
||||
useEffect,
|
||||
useRef,
|
||||
type KeyboardEvent,
|
||||
type PointerEvent,
|
||||
} from "react";
|
||||
import { Box } from "@mantine/core";
|
||||
|
||||
export interface ResizeHandleProps {
|
||||
|
|
@ -45,6 +50,13 @@ export function ResizeHandle({
|
|||
// Gesture origin, captured on pointer down. `null` while idle.
|
||||
const drag = useRef<{ startX: number; startWidth: number } | null>(null);
|
||||
|
||||
// If the handle unmounts mid-drag — the window narrows past the split
|
||||
// breakpoint or the server disconnects, either of which removes the handle
|
||||
// from the tree before a pointerup/cancel fires — the drag body class would
|
||||
// otherwise linger and leave `user-select: none` + `col-resize` applied
|
||||
// page-wide. Clear it on unmount so the class is self-healing.
|
||||
useEffect(() => () => document.body.classList.remove("resizing-col"), []);
|
||||
|
||||
function handlePointerDown(e: PointerEvent<HTMLDivElement>) {
|
||||
drag.current = { startX: e.clientX, startWidth: value };
|
||||
// Optional chaining: happy-dom (unit tests) doesn't implement pointer
|
||||
|
|
|
|||
Loading…
Reference in a new issue