Repository navigation
fix(Resizable): the Grab zone stays on the Handle whatever pillPlacement says, and a short item keeps its own drag - #9529
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ResizeHandle | 19.5 kB (+341 B) · 4.3 kB CSS (+279 B) | — | ✓ · ✓ · ✓ |
| SideNav | 66.3 kB (+327 B) · 11.1 kB CSS (+257 B) | — | — · — · — |
Package size: @astryxdesign/core 6.09 MB packed (−652 B); no new dependencies.
Touched components checked; add ci:run-visual, ci:run-a11y or ci:run-rtl to run the full suites.
Generated by PR Enrichment workflow | View full report
There was a problem hiding this comment.
Approval waits on an engineering owner's decision. component:Resizable FR1 describes the Grab zone only as a --spacing-4 strip, so it does not settle whether the zone should stay centred on the Handle for every pillPlacement, or shrink below that strip on a short pane (and spec:AST-094 FR42 exempts hit areas a component sets on purpose). An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. Whatever that decision, these need fixing:
- With
position="overlay"and the pill on the start side (including the defaultautoon a non-reversed Handle), the visible grip now sits outside the Grab zone, so dragging it moves the pane's content instead of resizing it (ResizeHandle.tsx:595-601). - A non-collapsible pane at size 0 (
minSize: 0) gets a 0px Grab zone and can no longer be reopened with a pointer (ResizeHandle.tsx:455). - Land #9297 first and rebase so this diff carries only its own two commits, and correct the changesets (the stacked one says "No behavior changes", and overlay Handles also shrink on panes under 32px).
[Automated review]
| isOverlay && | ||
| (isHorizontal | ||
| ? styles.hitAreaWithinHandleX | ||
| : styles.hitAreaWithinHandleY), |
There was a problem hiding this comment.
With position="overlay" the zone now stays inside the Handle's box. A start-side pill (pillPlacement="start", or the default auto on a non-reversed Handle) is still drawn 4-7px before the box, so the always-visible grip is no longer on the Grab zone. In Chromium, dragging the grip of a 2-hour overlay event moves the event instead of resizing it (main resizes it from 96 to 120px). Could the start pill sit inside the box, or the zone cover it, with a test that the pill's centre hits the zone?
There was a problem hiding this comment.
Fixed in 4f424ce: the pill takes the pointer wherever it is drawn, so a drag on an overlay Handle's start pill resizes the event. A browser test drags the pill and fails before the fix.
| // The pane the Handle resizes, while it has any length: an inline zone | ||
| // reaches at most half of it, and an overlay Handle takes at most half of | ||
| // it. A collapsed pane has nothing to protect and keeps the whole zone. | ||
| const paneLength = isCollapsed ? undefined : resizable?._size; |
There was a problem hiding this comment.
A pane at size 0 that is not collapsed (minSize: 0, or a 0 snap point) passes 0 here, so the zone becomes min(--spacing-4, 0px) = 0px beside a 0px Handle, and a pointer can no longer reopen it. Main keeps a 16px zone and reopens on drag. Suggest isCollapsed || size <= 0 ? undefined : size, with a unit test.
There was a problem hiding this comment.
Fixed in 4f424ce: a 0px pane that is not collapsed keeps the whole Grab zone, with a unit test that fails before the fix.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [chore] The configuration-object `useResizable` and `ResizeHandle`'s `resizable` path go through one internal resize factory and one input module, through the same size model as before, so the region's state and the handle's input each have one implementation. No behavior changes. |
There was a problem hiding this comment.
"No behavior changes" is not quite right: a ResizeHandle whose resizable prop goes away mid-drag now clears the resize cursor and ends the gesture as cancelled, and the new test for that fails on main. Consider a [fix] line for it.
There was a problem hiding this comment.
Fixed: the mid-drag release has its own [fix] changeset, in #9680, where the input extraction now lives.
| // The zone sits centred on the Handle; `pillPlacement` moves only | ||
| // the pill (component:Resizable FR1). |
There was a problem hiding this comment.
Non-blocking: this repeats the reason already given on hitAreaCenteredY's style comment; it can go.
There was a problem hiding this comment.
Removed in 4f424ce: the call site no longer repeats the reason on hitAreaCenteredY's style comment.
036dd42 to
6219415
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision. component:Resizable FR1 describes the Grab zone only as a --spacing-4 strip, so it does not settle whether the zone should stay centred on the Handle for every pillPlacement, or shrink below that strip on a short pane (and spec:AST-094 FR42 exempts hit areas a component sets on purpose). An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so if they are an engineering owner. Whatever that decision, these need fixing:
- The visible grip no longer sits on the Grab zone for end-side inline pills (including the default
autopill on a reversed Handle or a collapsed start panel) or for start-side overlay pills, so dragging it moves the content or does nothing instead of resizing (ResizeHandle.tsx:594-600). - A non-collapsible pane at size 0 (
minSize: 0) gets a 0px Grab zone and can no longer be reopened with a pointer (ResizeHandle.tsx:454). - Land #9297 first and rebase so this diff carries only its own two commits. Correct the changesets: the stacked one says "No behavior changes", and overlay Handles also shrink on panes under 32px.
[Automated review]
| // the pill. | ||
| isHorizontal | ||
| ? rtlStyles.centerInline('0px') | ||
| : styles.hitAreaCenteredY, |
There was a problem hiding this comment.
With the zone centred here, the pill keeps its old offset from the Handle's start edge (pillOffsetX/pillOffsetY), so an end-side pill sits at +7 to +10px against a zone that ends at +8px. In Chromium the grip's centre is off the zone for pillPlacement="end", for the default auto on a reversed Handle (an end panel), and for auto on a collapsed start panel. Dragging the grip there does nothing: an end panel stays at 160px where main grows it to 200px. Could the end pill sit inside the strip as the start pill does (+4 to +7px), with a test that the pill's centre hits the zone for every placement and both positions?
There was a problem hiding this comment.
Fixed in 4f424ce: the pill takes the pointer wherever it is drawn, so an end pill (pillPlacement="end", or auto on a reversed or collapsed start Handle) resizes the pane. A browser test drags the pill for each placement, inline and overlay.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] `ResizeHandle`'s grab zone stays centred on the divider whatever `pillPlacement` says, which now moves only the pill, and on a pane shorter than the zone it takes at most half the pane. A short item, such as a 30-minute calendar event resized from its edge, keeps its own drag. |
There was a problem hiding this comment.
An overlay Handle shrinks on any pane under 32px, not only on a pane shorter than the zone: on a 24px event it goes from 16px to 12px. Maybe: "an inline zone takes at most half a pane shorter than it; an overlay Handle takes at most half the pane it sits in."
There was a problem hiding this comment.
Taken: the changeset now says an inline zone takes at most half of a pane shorter than it, and an overlay Handle at most half of the pane it sits in.
6219415 to
4f424ce
Compare
There was a problem hiding this comment.
Approval waits on an engineering owner's decision about the Grab zone direction. component:Resizable FR1 describes the zone only as a --spacing-4 strip, and design:bidirectionality DR8 and DR12 ask for a pointer target centred on the visible control in both directions, so neither settles keeping the zone centred on the Handle for every pillPlacement (with the grip as its own target), or shrinking it below that strip on a short pane; spec:AST-094 FR42 exempts hit areas a component sets on purpose. An engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request, and the author may do so as an engineering owner, ideally with an FR1 amendment that states where the zone sits and the short-pane limit.
The grip-drag and zero-size-pane regressions from the last round are fixed, and the changesets now match the behaviour. Optional: the description's "a pane longer than the strip keeps its 16px zone" does not hold for an overlay Handle on a 16 to 32px pane, and a few new comments in ResizeHandle.tsx can be trimmed.
[Automated review]
| * window. | ||
| * The handle's input (the pointer drag, the keys, the double-click) is | ||
| * resizeGesture.ts. ResizeHandle forwards its React events to it, over the | ||
| * region its `resizable` prop describes. A drag takes pointer capture on the grab zone. |
There was a problem hiding this comment.
Non-blocking: a drag that starts on the Grip pill now takes capture on the pill, not the grab zone. Maybe: "A drag takes pointer capture on the element it starts on, so moves over an embedded frame still arrive."
There was a problem hiding this comment.
Taken in 5353427: "A drag takes pointer capture on the element it starts on, so moves over an embedded frame still arrive."
| insetBlockStart: '50%', | ||
| transform: 'translateY(-50%)', | ||
| }, | ||
| // Inside an overlay Handle, the zone never outgrows the Handle. |
There was a problem hiding this comment.
Non-blocking: this restates min(…, 100%) below it; it can go.
|
/approve-spec 5353427 |
5353427 to
5783132
Compare
|
/approve-spec 5783132 |
There was a problem hiding this comment.
Changes requested: the Grab zone direction is approved for this head and the short-item fix works, but one regression needs a fix.
- A pill revealed on hover (
isAlwaysVisible={false}) on an overlay Handle, where it sits outside the Grab zone (start/autoin LTR,endin RTL), hides as soon as the pointer leaves the zone to reach it, so SideNav's resizable rail in RTL loses dragging from its visible grip (it still works in LTR), and the changeset's "a drag on the pill still resizes wherever the pill is drawn" does not hold there (ResizeHandle.tsx:548-552,:231).
Please keep that pill reachable from the zone and add a browser case for an overlay Handle with isAlwaysVisible={false} in LTR start and RTL end. The inline comment notes are optional, and #9680 should land first since this branch carries its commits.
[Automated review]
| onPointerLeave: () => { | ||
| if (!isDragging) { | ||
| setIsHovered(false); | ||
| } | ||
| }, |
There was a problem hiding this comment.
When the pill sits outside the zone (an overlay Handle with start/auto in LTR or end in RTL), moving the pointer from the zone toward a hover-revealed pill (isAlwaysVisible={false}) fires this leave. The pill goes back to pointer-events: none (line 231), and a press where it showed reaches the content. SideNav's resizable rail hits this in RTL: its grip appears 4px from the zone and is gone before the pointer gets there, though it works in LTR. Keeping the pill reachable from the zone (for example, a pill target that spans the gap) would fix it.
There was a problem hiding this comment.
Fixed in b79aa8e: the hover stays for 150 ms after the pointer leaves the zone or the pill, so a hover-revealed pill outside the zone stays shown and takes the pointer while the pointer crosses to it. a015047 adds the browser case for an overlay Handle in left-to-right start and right-to-left end, and it fails before the fix.
| // The pill's offset takes a direction multiplier: -1 for the start side, 1 | ||
| // for the end side. |
There was a problem hiding this comment.
Non-blocking: this restates the dir parameter. Typing it dir: -1 | 1 says the same, and then the comment can go.
There was a problem hiding this comment.
Taken in b79aa8e: dir: -1 | 1, and the comment is gone.
| * @output createResizeGesture: the window splitter's input in one place: a | ||
| * pointer drag that holds its pointer, the arrow keys, Home, End and Enter, | ||
| * and a double-click collapse; and the body's drag cursor |
There was a problem hiding this comment.
Non-blocking: this @output runs about 35 words. Shorter: createResizeGesture: one handle's window-splitter input (pointer drag, keys, double-click) and the body's drag cursor.
There was a problem hiding this comment.
That header came with #9680, now on main. I'll shorten it in a follow-up instead of in this fix.
…s and how it shrinks on a short pane FR1 named the Grab zone only as a --spacing-4 strip. It now adds the owner's ruling, word for word: the grab zone is centred on the Handle for every pillPlacement, and the painted pill is its own grab target; on a pane too short for the full strip, the zone shrinks so the pane keeps at least half of itself. FR1's basis names the owner ruling, and its verification row names the browser spec that checks the zone's place and its short-pane limit.
…e it starts, and a restating comment goes A drag that starts on the Grip pill takes capture on the pill, not on the grab zone, so the header names the element the drag starts on. The comment over the overlay zone's width restated its min(…, 100%).
… reachable from the Grab zone An overlay Handle can draw its pill outside the Grab zone: at start in left-to-right, and at end in right-to-left. A pill that shows only on hover then hides as the pointer leaves the zone to reach it, and a drag from where it showed does nothing. A story puts a hover-revealed pill beside an overlay Handle, and the browser spec crosses from the zone to the pill and drags it, in both directions. They fail here: the size stays 250 after the drag.
An overlay Handle can draw its pill outside the Grab zone, so the pointer leaves the zone to reach it. The hover now stays for 150 ms after the pointer leaves the zone or the pill, and entering either one keeps it. So a hover-revealed pill stays shown and takes the pointer while the pointer crosses to it. The pill's offset functions take -1 | 1.
5783132 to
b79aa8e
Compare
There was a problem hiding this comment.
Requesting changes. The Grab zone placement and the short-pane limit match the owner-approved component:Resizable FR1, and the new tests and measurements back them; one blocking issue remains.
- The hover-revealed pill depends on a component-local 150 ms hover exit timer (
ResizeHandle.tsx:67-69,:565-572), a second hover-timing implementation thatarchitecture:interaction-modalityINV11 reserves for the shared hover recognizer, so SideNav's RTL grip, drawn 4px outside the zone, is lost when the pointer rests longer than 150 ms on the way to it and a finger is served by the timer.
Next: keep the pill reachable by geometry instead, for example with an invisible hit extension across the gap to the zone, then remove the timer and its unmount Effect and add a rest in the gap to the hover-pill browser case. Two optional comment trims are noted inline.
[Automated review]
| onPointerLeave: () => { | ||
| if (!isDragging && hoverExitRef.current == null) { | ||
| hoverExitRef.current = setTimeout(() => { | ||
| hoverExitRef.current = null; | ||
| setIsHovered(false); | ||
| }, PILL_HOVER_GRACE_MS); | ||
| } | ||
| }, |
There was a problem hiding this comment.
Blocking: this 150 ms exit timer is a second hover-timing implementation; architecture:interaction-modality INV11 makes the exit guard a setting of the shared hover recognizer and says a finger is never served by it. In RTL SideNav the grip sits 4px outside the zone, so a pointer that rests longer than 150 ms in that gap loses it, and a tap leaves the pill grabbable for 150 ms after the finger lifts. A geometric bridge (for example an invisible hit extension on the pill across the --spacing-1 gap to the zone) keeps the pill reachable with no timer; then the Effect at lines 384-391 can go too.
There was a problem hiding this comment.
| // An overlay Handle takes at most half of its containing block, the pane it | ||
| // sits in. A short pane keeps half of itself for its own pointer targets. A | ||
| // collapsed pane keeps the full Handle, which reopens it. |
There was a problem hiding this comment.
Non-blocking (INV29): the short-pane rule is stated here, at lines 252-253 and at 469-471. Keeping only the comment at 469-471 says it once.
There was a problem hiding this comment.
Done in f9a1753: the rule is stated once, where the pane length is read.
| * The handle element is 1px wide (the divider line itself). A wider, | ||
| * absolutely positioned hit area (the Grab zone) takes the pointer, centred | ||
| * on the Handle whatever `pillPlacement` says. On a pane shorter than the | ||
| * zone, it takes at most half the pane, so a short item keeps its own | ||
| * targets. The Grip pill takes the pointer too while it is painted. |
There was a problem hiding this comment.
Non-blocking (INV29): the header now runs 24 lines and this prose repeats the component JSDoc. Keeping @input, @output, @position and "A drag takes pointer capture on the element it starts on, so moves over an embedded frame still arrive." is enough.
There was a problem hiding this comment.
Done in f9a1753: the header keeps its tags and the capture sentence.
…rests between the Grab zone and the pill The browser case now rests 300 ms in the gap between the zone and the pill before it reaches the pill and drags. A pointer that pauses on the way must not lose the pill, so the pill has to stay reachable by its geometry, not by a grace time. It fails here: the 150 ms hover grace runs out during the rest, and the pill hides (opacity 0).
…rab zone, with no hover timer The 150 ms hover grace was a second hover-timing implementation, which architecture:interaction-modality INV11 keeps in the shared hover recognizer. A pointer that rested in the gap also lost the pill. The pill shown on hover now carries an invisible extension along the resize axis that spans the --spacing-1 gap to the zone. It takes the pointer only while the pill does. The timer and its unmount Effect go. The header keeps its tags and the capture sentence, and the short-pane rule is stated once, where the pane length is read.
There was a problem hiding this comment.
Recommending approval. The Grab zone now stays centred on the divider for every pillPlacement, a short pane keeps at least half of itself outside the pill, and a hover-revealed pill stays reachable across the gap to the zone without a timer, which resolves the earlier request for changes. The amended component:Resizable FR1 carries an engineering owner's approval for this content.
Non-blocking:
- The comment on the pill's invisible extension says it spans the gap, but the extension grows on both sides of the pill; saying so, and why, would match the code.
[Automated review]
| // A pill shown on hover can sit outside the Grab zone. This invisible | ||
| // extension spans the gap along the resize axis, so the pointer keeps the | ||
| // hover on its way to the pill. It takes the pointer only while the pill | ||
| // does. |
There was a problem hiding this comment.
Non-blocking: insetInline (and insetBlock below) grow this extension 5px on both sides of the pill, not only across the gap toward the zone. Maybe: "A pill shown on hover can sit outside the Grab zone. This invisible extension spans the gap, so the pointer keeps the hover on its way to the pill. It grows the same on both sides, so its hit area stays centred on the pill. It takes the pointer only while the pill does."
|
/approve-spec f9a1753 |
…side The hover-pill browser case now checks the point 3 px past the pill's side away from the zone: it must find the pane, not the pill. So the pill's hit area cannot cover more of a short item than the pill does. It fails here: the pill's bridge reaches out on both sides, so the point past the far side finds the pill.
…e Handle The pill's invisible extension reached out on both sides along the resize axis. On a short item, its far side covered the item's own drag at the pill's column, past what FR1 lets the pill take. It now spans only the gap toward the Handle, so it reaches no further than the pill. The pill's offset is a physical translate, so the bridge picks its physical side, with logical insets that swap under RTL.
…oss the gap to the Grab zone An owner ruling adds the sentence verbatim: a pill shown only on hover also takes the pointer across the gap between it and the Grab zone, never past the pill's far side.
|
/approve-spec 6693aa4 |
There was a problem hiding this comment.
Recommending approval. The Grab zone now stays centred on the divider for every pillPlacement, a short pane keeps at least half of itself, and the hover-revealed pill's extension now stops at the pill's far side, all as component:Resizable FR1 states in its amended form, which is approved for this head.
Two optional follow-ups:
- In the "Hover Pill On Overlay Handle" story, the overlay
ResizeHandleis a sibling ofLayoutPanel, so it positions against the page and renders at the page's edge instead of the sidebar's; oneposition: relativewrapper around both, as SideNav's resizable rail uses, keeps the fixture realistic. - The extension comment in
ResizeHandle.tsxcould say one thing per sentence: "It stops at the pill's far side. It takes the pointer only while the pill does."
[Automated review]
| <LayoutPanel width={sidebar.size} hasDivider={false}> | ||
| <Text>{sidebar.size}px</Text> | ||
| </LayoutPanel> | ||
| <ResizeHandle |
There was a problem hiding this comment.
Non-blocking: this overlay ResizeHandle is a sibling of LayoutPanel, so its containing block is the page. In Chromium at 640px wide it renders at x 624–640, past the 250px sidebar. One position: relative wrapper around the panel and the Handle, as SideNav's resizable rail uses, keeps the fixture realistic.
| // on its way to the pill. It reaches no further than the pill, and it takes | ||
| // the pointer only while the pill does. The pill's offset is a physical |
There was a problem hiding this comment.
Non-blocking (comment style): this sentence carries two topics, and "no further than the pill" is vague. Maybe: "It stops at the pill's far side. It takes the pointer only while the pill does."
On main; its commits: vjeux/astryx@35f558e...6693aa4.
User impact
On a 30-minute calendar event at 48px an hour, the Grab zone covered 13.5px of 24px, taking the event's drag. Now each event keeps half of itself.
Problem and solution fit
--spacing-4strip on any pane.Expected behavior and authority
component:ResizableFR1, amended here, and FR2.spec:AST-094FR42: a grown hit area stops at half the gap to a neighbor's target; the short-pane limit follows.Smallest restoration
pillPlacement.[fix]changeset; no API change.Evidence
pillPlacementand position, the zone is centred within 0.5px and covers at most half of each event; the body moves the event, and the Handle or pill resizes it. A hover-revealed pill outside an overlay zone stays reachable and resizes, in both directions.Writing rubric results
Over
component:Resizable: FR1 gains three sentences: where the zone sits, its short-pane limit, and a hover pill's reach across the gap; its verification row names the browser spec. The record is owner-gated, so it waits for a spec owner's/approve-spec.Scope
Testing
Local checks at 6693aa4, on main 35f558e: core typecheck, the Resizable, Layout, SideNav and AppShell units (747 passed), strict eslint and prettier on the changed files, and the comment-length check. Browser: the Grab zone spec and SideNav's rail motion in Chromium (33/33), and the hover-pill case under a 2-thread pin with 4 workers, x10 (20/20). Red first: the hover-pill case fails before its first fix (2/2: the size stays 250), its 300 ms rest in the gap fails against a hover timer (2/2: the pill hides), and its far-side check fails against a two-sided bridge (2/2). Full gates at this head, after CodeBunny's approval: lint, the ui suite (19,014 passed), build, typecheck, the API report, the node suite (8 CLI cases timed out under box load and pass alone, 686/686), the docsite build and tests, the Storybook build, the a11y contract (2,390 of 2,391: one Chat capture timed out loading its story under load and passes alone, 3/3), the Grab zone spec and SideNav's rail motion in Chromium (33/33) and x24 under the 2-thread pin (552/552), WebKit x10 (230 passed), and the a11y audit of every story (no new violations).