Skip to content

fix(ResizeHandle): arrows move between snap points - #7514

Merged
cixzhang merged 5 commits into
mainfrom
fix/resizehandle-snap-arrows
Oct 14, 2026
Merged

cixzhang merged 5 commits into
mainfrom
fix/resizehandle-snap-arrows

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What changes for users

A keyboard user on a ResizeHandle whose 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 follows isReversed and 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-020 FR15 (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 through adjacentSnapPoint(resizable, direction, count) — the snap points clamped into the bounds (a point beyond minSize or maxSize counts as that bound), deduplicated and sorted, ahead of the current size, the count-th one or the last available — and moves by target − size. Regions without snap points step as before.
  • Tests (red on 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.
  • Changeset (patch).

Record

Per the fix-PR rule, component:Resizable AR1 gains "with snap points set, an arrow moves to the adjacent snap point, a point beyond minSize or maxSize counting 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's bare-snapped known failure is the executable record of it.

Order

Merges after #7485 and empties its bare-snapped known-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.

…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.
@vercel

vercel Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Oct 14, 2026 7:02am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 14, 2026
@astracat-bot

astracat-bot Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 14, 2026, 7:25 AM UTC

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 34eca1b

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec d9df60e

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

44 of 448 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 754,077
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,188
Chat Full AI Chat probe light 238,081
Chat Full AI Chat probe dark 237,048
Markdown Default probe light 159,625
Markdown Default probe dark 158,986
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 33,205
Chat Default neutral light 32,876
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
TableRowExpansion Detail Panel neutral dark 5,150
TableRowExpansion Detail Panel neutral light 4,068

and 24 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
*/
/**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 33f67aa

@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 6dce370

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]

Comment on lines +631 to +639
resizable._onResizeStart();
resizable._onResizeMove(
adjacentSnapPoint(
resizable,
grows(e.key) ? 1 : -1,
e.shiftKey ? 2 : 1,
) - resizable._size,
);
resizable._onResizeEnd();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@cixzhang
cixzhang merged commit a05bcd2 into main Oct 14, 2026
56 checks passed
@github-actions
github-actions Bot deleted the fix/resizehandle-snap-arrows branch October 15, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — 6dce370f Deployed Oct 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant