Repository navigation
fix(ResizeHandle): arrows move between snap points - #7514
Conversation
…nap point (Shift, two), within the bounds A 10px keyboard step snapped straight back to the point it started on, so the arrows did nothing on a snapped region (APG Window Splitter: the arrows move the separator). The arrow now moves to the adjacent point in its direction, two with Shift, clamped to the first and last point inside the bounds; direction follows isReversed and RTL as before. AR1 states it; three red-armed tests.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec 34eca1b |
… when the region has them; test
|
/approve-spec d9df60e |
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression44 of 448 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 24 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
One small change is needed before this lands: snap points beyond minSize/maxSize are dropped instead of clamped to the bounds, so where the pane rests on a bound the arrows can leave it but never return (with snaps: [100, 200, 300, 450] and maxSize: 400, End reaches 400 and ArrowLeft moves to 300, but ArrowRight then stays at 300). Clamping each snap point into the bounds and de-duplicating in adjacentSnapPoint, plus a test with a snap point past each bound, would match the "clamped to the bounds" behavior; the in-bounds cases already work and the new tests cover them well. While there, please move adjacentSnapPoint off toggleCollapse's doc comment, and consider noting in the changeset that a shrink arrow at the lowest snap point of a collapsible pane no longer collapses it (Enter still does).
[Automated review]
| count: number, | ||
| ): number { | ||
| const points = [...resizable._snaps] | ||
| .filter(p => p >= resizable._minSizePx && p <= resizable._maxSizePx) |
There was a problem hiding this comment.
Snap points outside the bounds are dropped here, but the hook clamps an out-of-bounds nearest point into the bounds, so the pane can rest on a bound that the arrows then cannot return to. With snaps: [100, 200, 300, 450], minSize: 100 and maxSize: 400: End → 400, ArrowLeft → 300, ArrowRight stays at 300 (the mirror case happens at the minimum). Clamping instead of filtering matches "clamped to the bounds":
const points = [
...new Set(
resizable._snaps.map(p =>
Math.min(resizable._maxSizePx, Math.max(resizable._minSizePx, p)),
),
),
].sort((a, b) => a - b);Where a clamped bound is not a rest position, the hook re-snaps and the arrow stays put, as it does now. A test with a snap point beyond each bound would pin it.
| * gesture to the minimum, which also cannot reopen a pane whose minimum sits below its | ||
| * collapse threshold. | ||
| */ | ||
| /** |
There was a problem hiding this comment.
This block landed between toggleCollapse's doc comment (just above) and toggleCollapse itself, so that comment now reads as documentation for adjacentSnapPoint. Moving adjacentSnapPoint above the toggleCollapse comment, or below the function, keeps each comment on its function.
… helper off toggleCollapse's doc comment; record and Changeset follow
|
/approve-spec 33f67aa |
…nt point (step 100) and its known-failure row goes
|
/approve-spec 6dce370 |
There was a problem hiding this comment.
This looks ready to approve: with snap points set, the arrow keys now move the pane to the adjacent point (Shift moves two), a point beyond the bounds counts as that bound, and the new tests plus the Window Splitter contract cover each direction mode. The earlier requests (clamping out-of-range snap points, moving adjacentSnapPoint off toggleCollapse's comment, and noting the collapse change in the changeset) are all addressed. One optional hardening, noted inline: skipping the move when no snap point lies ahead keeps a pane that rests below its collapse threshold from collapsing on a no-op arrow.
[Automated review]
| resizable._onResizeStart(); | ||
| resizable._onResizeMove( | ||
| adjacentSnapPoint( | ||
| resizable, | ||
| grows(e.key) ? 1 : -1, | ||
| e.shiftKey ? 2 : 1, | ||
| ) - resizable._size, | ||
| ); | ||
| resizable._onResizeEnd(); |
There was a problem hiding this comment.
Optional hardening: when no snap point lies ahead, adjacentSnapPoint returns the current size and this still runs a zero-length move. On a pane resting on a snap point below its collapse threshold (minSize under collapsedSize, e.g. minSize: 20 with snaps [20, 100, 200] and the default 40 px threshold), the hook treats that move as a drag below the threshold and collapses the pane, so the changeset's "no longer collapses" does not hold there. Skipping start/move/end when the target equals resizable._size keeps a no-op arrow a no-op.
What changes for users
A keyboard user on a
ResizeHandlewhose region sets snap points presses an arrow and the pane moves to the adjacent snap point in that direction (Shift moves two), staying within the bounds. A 10 px step used to snap straight back to the point it started on, so the arrows did nothing on a snapped region (APG Window Splitter: the arrows move the separator). Direction followsisReversedand the reading direction as before; pointer drags, Home, End and Enter are unchanged. With snap points, a shrink arrow at the lowest point no longer collapses a collapsible pane (it has no lower point to move to); Enter, double-click and dragging still collapse it.Authority
Path (a):
spec:AST-020FR15 (current) plus the owner's 2026-10-13 adopt-and-patch approval for ResizeHandle's APG Window Splitter adoption; the maintainers' ruling (a) of 2026-10-13: with snap points set, an arrow moves to the adjacent snap point in its direction, Shift two, clamped to bounds.Shape
ResizeHandle.tsx: on an open region with_snaps, the arrow branch resolves the target throughadjacentSnapPoint(resizable, direction, count)— the snap points clamped into the bounds (a point beyondminSizeormaxSizecounts as that bound), deduplicated and sorted, ahead of the current size, thecount-th one or the last available — and moves bytarget − size. Regions without snap points step as before.main): "with snap points, an arrow moves to the adjacent point in its direction and Shift moves two, clamped to the ends", "with snap points past the bounds, a point beyond maxSize or minSize counts as that bound", "with snap points, the arrows follow the reversed layout and the reading direction", "with snap points in a reversed layout, ArrowLeft moves to the next point and ArrowRight to the previous", "with snap points, the grow arrow opens a collapsed pane at the snap point nearest one step above its minimum". Resizable + SideNav: 372/372.Record
Per the fix-PR rule,
component:ResizableAR1 gains "with snap points set, an arrow moves to the adjacent snap point, a point beyondminSizeormaxSizecounting as that bound (Shift, two);", its collapsed-pane sentence adds "(with snap points, at the snap point nearest that size; …)", and the AR1 verification row cites the five new titles. No gap entry existed for this case; the Window Splitter binding'sbare-snappedknown failure is the executable record of it.Order
Merges after #7485 and empties its
bare-snappedknown-failure row (if #7485 merges first, that row is removed here instead).Writing rubric results
R1 narration: none; AR1 stays present tense.
R2 research: none in the record.
R3 evidence: the verification cell cites test titles, not this pull request.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: unchanged.