An open source design system that's fully customizable and agent ready
TypeScript
fix(Resizable): the Grab zone stays on the Handle whatever pillPlacement says, and a short item keeps its own drag (#9529)
Christopher Chedeaub377b211b1be
diff --git a/.changeset/resize-handle-grab-zone-on-handle.md b/.changeset/resize-handle-grab-zone-on-handle.mdnew file mode 100644index 0000000000..020becb1e9--- /dev/null+++ b/.changeset/resize-handle-grab-zone-on-handle.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] `ResizeHandle`'s grab zone stays centred on the divider whatever `pillPlacement` says, which now moves only the pill. An inline zone takes at most half of a pane shorter than it, and an overlay Handle takes at most half of the pane it sits in. A short item, such as a 30-minute calendar event resized from its edge, keeps its own drag, and a drag on the pill still resizes wherever the pill is drawn.++@vjeuxdiff --git a/apps/storybook/rtl-audit/README.md b/apps/storybook/rtl-audit/README.mdindex 53a57abf15..14479e8897 100644--- a/apps/storybook/rtl-audit/README.md+++ b/apps/storybook/rtl-audit/README.md@@ -192,8 +192,8 @@ spike this guard removed the single false positive.its parent's width** is skipped: a full-bleed strip spans the _entire_ parent,so it occupies both halves and has **no left/right side** to land on the wrongone. This catches `useResizable`'s **vertical** grab zone (`ResizeHandle`'s-`hitAreaOffsetY`): a full-width strip anchored `insetInlineStart:0;-insetInlineEnd:0` with a purely-visual centering `translate(-50%,…)`, so its+`hitAreaCenteredY`): a full-width strip anchored `insetInlineStart:0;+insetInlineEnd:0` and centred on the block axis only, so itsgeometric _center_ sits at the parent origin (relCenterX≈0) **identically in LTRand RTL**. The mirror assertion would otherwise compute `expected = parentW − 0= parentW` and fire a spurious `Δ = parentW`. The degenerate-parent guard missesdiff --git a/apps/storybook/stories/Resizable.stories.tsx b/apps/storybook/stories/Resizable.stories.tsxindex bd58b5a219..da8f431410 100644--- a/apps/storybook/stories/Resizable.stories.tsx+++ b/apps/storybook/stories/Resizable.stories.tsx@@ -1,5 +1,6 @@// Copyright (c) Meta Platforms, Inc. and affiliates.+import {useRef, useState} from 'react';import type {Meta, StoryObj} from '@storybook/react';import * as stylex from '@stylexjs/stylex';import {colorVars, radiusVars} from '@astryxdesign/core/theme/tokens.stylex';@@ -564,3 +565,183 @@ export const WithEmbeddedFrame: Story = {);},};++const cal = stylex.create({+ column: {+ position: 'relative',+ width: 240,+ height: 192,+ borderWidth: 1,+ borderStyle: 'solid',+ borderColor: colorVars['--color-border'],+ borderRadius: radiusVars['--radius-container'],+ },+ // A calendar event: its body moves it, and the Handle on its bottom edge+ // changes how long it lasts.+ event: (top: number, height: number) => ({+ position: 'absolute',+ insetInlineStart: 8,+ insetInlineEnd: 8,+ top,+ height,+ display: 'flex',+ flexDirection: 'column',+ overflow: 'visible',+ borderRadius: radiusVars['--radius-element'],+ backgroundColor: colorVars['--color-background-muted'],+ }),+ eventBody: {+ flexGrow: 1,+ minHeight: 0,+ cursor: 'move',+ touchAction: 'none',+ },+});++/** At 48px an hour, as a day view draws it. */+const PX_PER_HOUR = 48;++/**+ * One event of a calendar column: dragging its body moves it, and its+ * ResizeHandle changes its length. The event keeps its own drag however short+ * it is: the Grab zone stays on the Handle, whatever `pillPlacement` says, and+ * takes at most half the event (component:Resizable FR1).+ */+function CalendarEvent({+ testId,+ minutes,+ initialTop,+ pillPlacement,+ position,+}: {+ testId: string;+ minutes: number;+ initialTop: number;+ pillPlacement: 'auto' | 'start' | 'center' | 'end';+ position: 'inline' | 'overlay';+}) {+ const length = useResizable({+ defaultSize: (minutes / 60) * PX_PER_HOUR,+ minSize: PX_PER_HOUR / 8,+ direction: 'vertical',+ });+ const [top, setTop] = useState(initialTop);+ const moveRef = useRef<{y: number; top: number} | null>(null);+ return (+ <div+ data-testid={testId}+ data-top={top}+ {...stylex.props(cal.event(top, length.size))}>+ <div+ data-testid={`${testId}-body`}+ {...stylex.props(cal.eventBody)}+ onPointerDown={event => {+ moveRef.current = {y: event.clientY, top};+ event.currentTarget.setPointerCapture(event.pointerId);+ }}+ onPointerMove={event => {+ const move = moveRef.current;+ if (move != null) {+ setTop(move.top + event.clientY - move.y);+ }+ }}+ onPointerUp={() => {+ moveRef.current = null;+ }}>+ <Text type="supporting">{minutes} min</Text>+ </div>+ <ResizeHandle+ direction="vertical"+ position={position}+ pillPlacement={pillPlacement}+ resizable={length.props}+ label={`Resize the ${minutes}-minute event`}+ />+ </div>+ );+}++/**+ * Browser fixture for the Grab zone on a short item: a 30-minute and a+ * 15-minute event, each resized from its bottom edge.+ */+function ShortItems({+ pillPlacement,+ position,+}: {+ pillPlacement: 'auto' | 'start' | 'center' | 'end';+ position: 'inline' | 'overlay';+}) {+ return (+ <div {...stylex.props(cal.column)}>+ <CalendarEvent+ testId="thirty"+ minutes={30}+ initialTop={24}+ pillPlacement={pillPlacement}+ position={position}+ />+ <CalendarEvent+ testId="fifteen"+ minutes={15}+ initialTop={120}+ pillPlacement={pillPlacement}+ position={position}+ />+ </div>+ );+}++export const GrabZoneOnShortItems: StoryObj<typeof ShortItems> = {+ tags: ['!autodocs', 'no-visual'],+ args: {pillPlacement: 'auto', position: 'inline'},+ render: args => <ShortItems {...args} />,+};++/**+ * Browser fixture for a pill that shows on hover beside an overlay Handle.+ * The pill can sit outside the Grab zone, so the pointer crosses a gap to+ * reach it.+ */+function HoverPillOnOverlay({+ pillPlacement,+ dir,+}: {+ pillPlacement: 'start' | 'end';+ dir: 'ltr' | 'rtl';+}) {+ const sidebar = useResizable({defaultSize: 250, minSize: 150, maxSize: 500});+ return (+ <div dir={dir} {...stylex.props(ps.shell)}>+ <Layout+ height="fill"+ start={+ <>+ <LayoutPanel width={sidebar.size} hasDivider={false}>+ <Text>{sidebar.size}px</Text>+ </LayoutPanel>+ <ResizeHandle+ direction="horizontal"+ position="overlay"+ pillPlacement={pillPlacement}+ isAlwaysVisible={false}+ resizable={sidebar.props}+ label="Resize sidebar"+ />+ </>+ }+ content={+ <LayoutContent>+ <Heading level={4}>Content</Heading>+ </LayoutContent>+ }+ />+ </div>+ );+}++export const HoverPillOnOverlayHandle: StoryObj<typeof HoverPillOnOverlay> = {+ tags: ['!autodocs', 'no-visual'],+ args: {pillPlacement: 'start', dir: 'ltr'},+ render: args => <HoverPillOnOverlay {...args} />,+};diff --git a/docs/specs/components/Resizable/Resizable.spec.md b/docs/specs/components/Resizable/Resizable.spec.mdindex 4e1153f2d3..dcb33663d8 100644--- a/docs/specs/components/Resizable/Resizable.spec.md+++ b/docs/specs/components/Resizable/Resizable.spec.md@@ -145,7 +145,7 @@ Consumer migration instructions belong in consumer docs and release notes.| ID | Invariant | Basis || --- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------- |-| FR1 | ResizeHandle renders one focusable Handle and one enlarged Grab zone (a `--spacing-4` strip on the resize axis); the default render also contains a Grip pill, and caller `children` replace the pill. | Current source, docs, and tests |+| FR1 | ResizeHandle renders one focusable Handle and one enlarged Grab zone (a `--spacing-4` strip on the resize axis); the default render also contains a Grip pill, and caller `children` replace the pill. 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. 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. | Current source, docs, tests, and an owner ruling || FR2 | The Handle carries `resize-handle`, the Grip pill carries `resize-handle-pill`, and the Grab zone carries no public target. | Current source and docs || FR3 | Pointer drag, keyboard, double-click collapse, snapping, persistence, reversal, and size behavior are owned by ResizeHandle and useResizable; dragging under right-to-left inverts the pointer delta so the divider follows the pointer. A disabled Handle ignores pointer and keyboard input and exposes `aria-disabled`, and keeps its tab stop (`spec:AST-085` FR1). With `autoSaveId`, storage holds the last settled size and receives the final size once when a drag ends, cancels, or unmounts. Implementation gap: a disabled Handle sets `tabIndex={-1}` (Current-state impact). | Current source, docs, and tests || FR4 | The Handle reflects the documented `direction` visual state on its target (`architecture:component-theming-surface` INV6). Implementation gap: it reflects no `direction` (Current-state impact). | Current source and docs |@@ -270,7 +270,7 @@ Consumer migration instructions belong in consumer docs and release notes.| Contract | Verification | Representative states | Mutation or failure expectation | Audit section || --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------- |-| FR1 | `ResizeHandle.test.tsx`; stable visual baseline `core-resizable--horizontal-split` | Default, collapsed, both axes | Handle and Grab zone regressions fail focused tests; a changed default handle comes back changed for review. Gap: no test renders `children` to prove they replace the Grip pill. | `audit:Resizable/anatomy` |+| FR1 | `ResizeHandle.test.tsx`; `grabZone.interaction.browser.spec.ts` for the zone's place and its short-pane limit; stable visual baseline `core-resizable--horizontal-split` | Default, collapsed, both axes | Handle and Grab zone regressions fail focused tests; a changed default handle comes back changed for review. Gap: no test renders `children` to prove they replace the Grip pill. | `audit:Resizable/anatomy` || FR2 | `themingTargets.test.ts`; source review | Handle, Grip pill, Grab zone | A removed target fails the inventory. `themingTargets.test.ts` catches only a renamed or undocumented target; no check fails if the Handle or Grip pill stops carrying its target. | `audit:Resizable/theming` || FR3 | `ResizeHandle.test.tsx` and `useResizable.test.ts`; storage timing: `ResizeHandle.test.tsx` ("saves the size once, when a drag ends on …", "saves the dragged size once when the split unmounts mid-drag", "still saves each keyboard step at once") and `useResizable.test.ts` ("writes the size a drag reached once, after … releases it", "writes the final size once when the release comes before the last move renders", "keeps the size a region was dragged to when it unmounts mid-drag", "writes only the re-clamped size when the container shrank mid-drag") | Pointer, keyboard, snap, collapse, persistence; RTL drag; disabled keyboard | A changed transformation, an RTL drag that moves against the pointer, keyboard input that resizes a disabled Handle, or a per-move, stale or missing final storage write fails. Gap: no test covers disabled pointer input or the disabled tab stop. | `audit:Resizable/behavior` || FR4 | Source and docs comparison | Horizontal and vertical Handle | Gap: no test detects that the documented `direction` is not reflected. | `audit:Resizable/theming` |diff --git a/packages/core/src/Resizable/Resizable.doc.mjs b/packages/core/src/Resizable/Resizable.doc.mjsindex eb90a0b1bf..c1408e20a1 100644--- a/packages/core/src/Resizable/Resizable.doc.mjs+++ b/packages/core/src/Resizable/Resizable.doc.mjs@@ -12,13 +12,13 @@ const anatomy = [name: 'Grip pill',required: false,description:- 'Default visible grip indicator; custom handle content can replace it.',+ 'Default visible grip indicator; dragging it resizes, wherever it sits. Custom handle content can replace it.',},{name: 'Grab zone',required: true,description:- 'Invisible enlarged pointer region aligned with the grip or divider.',+ 'Invisible enlarged pointer region centred on the divider. An inline zone takes at most half of a pane shorter than it; an overlay handle takes at most half of its pane.',},];@@ -224,7 +224,8 @@ const region = useResizable({description:'Which side of the divider the pill sits on. ' +'auto = content side (derived from isReversed), flips when collapsed. ' +- 'start = left/top, end = right/bottom, center = centered on divider.',+ 'start = left/top, end = right/bottom, center = centered on divider. ' ++ 'It moves only the pill, which a drag can still take wherever it sits; the grab zone stays centred on the divider.',default: "'auto'",},{@@ -317,7 +318,7 @@ export const docsDense = {isAlwaysVisible:'show pill grip at rest instead of only on hover. Use when discoverability important',pillPlacement:- 'which side of divider pill sits on. auto = content side (derived from isReversed), flips when collapsed; start = left/top, end = right/bottom, center = centered on divider',+ 'which side of divider pill sits on. auto = content side (derived from isReversed), flips when collapsed; start = left/top, end = right/bottom, center = centered on divider. Moves only the pill (still draggable); grab zone stays on the divider',label: 'accessible label for separator',resizable: 'resize props from useResizable: connects handle to panel',},diff --git a/packages/core/src/Resizable/ResizeHandle.test.tsx b/packages/core/src/Resizable/ResizeHandle.test.tsxindex a4b93f3396..7deb5483c8 100644--- a/packages/core/src/Resizable/ResizeHandle.test.tsx+++ b/packages/core/src/Resizable/ResizeHandle.test.tsx@@ -1107,64 +1107,88 @@ describe('ResizeHandle', () => {gcsSpy.mockRestore();});- // --- Hit-area geometry (grab zone tracks the visible pill) ----- it('anchors the biased grab zone with the pill offset and a dir-flipped centering shift', () => {- // For an off-center pill the hit area must reuse the pill's physical offset- // construction (anchored at insetInlineStart:0) rather than a divider-- // relative 50% anchor + percentage bias, so the two stay aligned in LTR and- // RTL. The half-width-difference centering shift (6.5px) is inline, so it- // flips physical sign under RTL: `- 6.5px` (LTR) vs `+ 6.5px` (RTL). See the- // Playwright measurement (hitArea.center === pill.center, 0px offset in both- // directions) for the geometric proof; here we lock the transform shape.- render(<Harness handleProps={{pillPlacement: 'start'}} />);- const hitArea = getSeparator().firstElementChild as HTMLElement;- expect(hitArea.className).toContain('hitAreaOffsetX');- const style = hitArea.getAttribute('style') ?? '';- // LTR (default) branch subtracts the centering shift; RTL branch adds it.- expect(style).toContain('- 6.5px');- expect(style).toContain('+ 6.5px');- });+ // --- Hit-area geometry (the grab zone stays on the Handle) ---++ // `pillPlacement` places only the pill: the grab zone sits centred on the+ // Handle, through the direction-symmetric rtlStyles.centerInline helper on+ // the inline axis (component:Resizable FR1). The browser proof+ // (grabZone.interaction.browser.spec.ts) measures the geometry.+ it.each(['auto', 'start', 'center', 'end'] as const)(+ 'centres the grab zone on the Handle with pillPlacement="%s"',+ pillPlacement => {+ render(<Harness handleProps={{pillPlacement}} />);+ const hitArea = getSeparator().firstElementChild as HTMLElement;+ expect(hitArea.className).toContain('centerInline');+ // centerInline's own centring, and no offset toward the pill.+ expect(hitArea.getAttribute('style') ?? '').toContain(+ 'translate(-50%, 0px)',+ );+ expect(hitArea.getAttribute('style') ?? '').not.toContain('6.5px');+ },+ );- it('centers the grab zone on the divider when the pill is centered (no bias)', () => {- render(<Harness handleProps={{pillPlacement: 'center'}} />);- const hitArea = getSeparator().firstElementChild as HTMLElement;- // Centered via the shared rtlStyles.centerInline helper (direction-symmetric- // left+translateX), not a biased offset.- expect(hitArea.className).toContain('centerInline');- expect(hitArea.className).not.toContain('hitAreaOffsetX');- });+ it.each(['auto', 'start', 'center', 'end'] as const)(+ 'centres a vertical grab zone on the Handle with pillPlacement="%s"',+ pillPlacement => {+ render(+ <Harness+ config={{defaultSize: 200, direction: 'vertical'}}+ handleProps={{direction: 'vertical', pillPlacement}}+ />,+ );+ const hitArea = getSeparator().firstElementChild as HTMLElement;+ expect(hitArea.className).toContain('hitAreaCenteredY');+ expect(hitArea.getAttribute('style') ?? '').not.toContain('translate');+ },+ );- // The grab zone is stretched along the handle by its 0/0 insets, so anything- // that moves it across the handle displaces the whole zone off the divider —- // a percentage does it by half the handle's length, so the taller the panel- // the larger the dead region, and nothing about it is visible on screen.- it.each([- ['horizontal' as const, 'translateX'],- ['vertical' as const, 'translateY'],- ])('offsets the %s grab zone along the pill axis only', (direction, axis) => {- render(+ // On a pane shorter than the zone, the zone reaches at most half the pane.+ // Grown targets stop at half the gap in the same way. A collapsed pane keeps+ // the whole zone, which reopens it.+ it('limits the grab zone to the length of a short pane, and not while it is collapsed', () => {+ const view = render(<Harness- config={{- defaultSize: 200,- minSize: 100,- maxSize: 400,- direction,- }}- handleProps={{direction, pillPlacement: 'start'}}+ config={{defaultSize: 12, minSize: 6, collapsible: true}}+ handleProps={{}}/>,);- const hitArea = getSeparator().firstElementChild as HTMLElement;- const translates = (hitArea.getAttribute('style') ?? '')- .split(';')- .map(decl => decl.split(/:(.*)/s)[1]?.trim() ?? '')- .filter(value => value.startsWith('translate'));-- // Both the LTR and RTL declarations of the horizontal offset.- expect(translates.length).toBeGreaterThan(0);- for (const translate of translates) {- expect(translate.startsWith(`${axis}(`)).toBe(true);- }+ const hitArea = () => getSeparator().firstElementChild as HTMLElement;+ expect(hitArea().getAttribute('style') ?? '').toContain('12px');+ fireEvent.keyDown(getSeparator(), {key: 'Enter'});+ expect(getSeparator()).toHaveAttribute('aria-valuetext', 'Collapsed');+ expect(hitArea().getAttribute('style') ?? '').not.toContain('min(');+ view.unmount();+ });++ // A pane at 0px that is not collapsed has no length to protect. It keeps+ // the whole zone, so a drag can reopen it.+ it.each(['inline', 'overlay'] as const)(+ 'keeps the whole grab zone on a pane at 0px that is not collapsed (%s)',+ position => {+ render(+ <Harness+ config={{defaultSize: 0, minSize: 0}}+ handleProps={{position}}+ />,+ );+ expect(getSeparator()).not.toHaveAttribute('aria-valuetext');+ const hitArea = getSeparator().firstElementChild as HTMLElement;+ expect(hitArea.getAttribute('style') ?? '').not.toContain('min(');+ expect(getSeparator().className).not.toContain('OnShortPane');+ },+ );++ it('starts a drag from the Grip pill as from the Grab zone', () => {+ const resizable = makeResizable();+ render(<ResizeHandle resizable={resizable} label="Resize" />);+ const pill = getSeparator().querySelector('.astryx-resize-handle-pill');+ expect(pill).not.toBeNull();+ fireEvent.pointerDown(pill as Element, {+ pointerId: 1,+ clientX: 0,+ button: 0,+ });+ expect(resizable._onResizeStart).toHaveBeenCalledTimes(1);});// --- Prop composition (ordering choice: handler sits after {...props}) ---diff --git a/packages/core/src/Resizable/ResizeHandle.tsx b/packages/core/src/Resizable/ResizeHandle.tsxindex 20e0be032e..1c10a60e99 100644--- a/packages/core/src/Resizable/ResizeHandle.tsx+++ b/packages/core/src/Resizable/ResizeHandle.tsx@@ -8,29 +8,12 @@* @output Styled drag handle with WAI-ARIA separator role and keyboard support* @position Between resizable panels; consumed directly by builders*- * The handle element is 1px wide (the divider line itself), with an- * absolutely-positioned wider hit area for pointer interaction.- * Pill grip indicator can sit on either side of the divider (or centered)- * via pillPlacement. Default 'auto' places the pill on the panel side and- * flips when the panel collapses to 0px so it stays accessible.- *- * Pill placement uses a single stylex dynamic style that accepts a direction- * multiplier (-1 or 1). The pill element has its own themeProps- * ('resize-handle-pill') so themes can target size/shape directly.- *- * While the panel is collapsed, aria-valuenow is clamped to aria-valuemin- * (a value below the minimum is invalid per WCAG 4.1.2) and a localized- * "Collapsed" aria-valuetext announces the real state.- *- * 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.- * The gesture's move, up and cancel events then go there, as in Slider, even- * over an embedded frame.+ * A drag takes pointer capture on the element it starts on, so moves over an+ * embedded frame still arrive.*/import {useEffect, useRef, useState} from 'react';-import type {ReactNode} from 'react';+import type {HTMLAttributes, ReactNode} from 'react';import * as stylex from '@stylexjs/stylex';import type {BaseProps} from '../BaseProps';import {@@ -81,30 +64,6 @@ function resolveEffectiveSide(return panelSide;}-/**- * Hit-area inline bias, expressed as a fraction of the pill's per-side offset.- *- * The visible pill is placed by `pillOffsetX`/`pillOffsetY`: anchored at the- * divider's inline-start edge and pushed one grip-width-plus-gap toward the- * panel side via a PHYSICAL translate (dir −1 = start, +1 = end). Because that- * offset is physical, the pill sits on the same physical side of the divider in- * both LTR and RTL. The grab zone must sit OVER that pill, so it has to use the- * exact same anchor + physical-offset construction as the pill (just wider) —- * anchoring the hit area at the divider centre (`insetInlineStart: 50%`) and- * biasing with a percentage translate mixes a logical anchor (which flips under- * RTL) with a physical translate (which doesn't), leaving the grab zone stranded- * to one side under RTL. Returning the pill's `dir` here lets the hit area reuse- * `pillOffsetX`/`pillOffsetY` so the two elements are positioned identically.- */-function hitAreaBiasDir(- effectiveSide: 'start' | 'end' | 'center',-): number | null {- if (effectiveSide === 'center') {- return null;- }- return effectiveSide === 'start' ? -1 : 1;-}-const styles = stylex.create({handle: {position: 'relative',@@ -137,6 +96,12 @@ const styles = stylex.create({insetInlineEnd: 0,height: 'var(--resize-handle-hit-area, 16px)',},+ overlayHorizontalOnShortPane: {+ width: 'min(var(--resize-handle-hit-area, 16px), 50%)',+ },+ overlayVerticalOnShortPane: {+ height: 'min(var(--resize-handle-hit-area, 16px), 50%)',+ },horizontal: {width: 1,height: '100%',@@ -196,19 +161,27 @@ const styles = stylex.create({':is(:disabled,[aria-disabled="true"])': 'default',},},- // Centered grab zone (pillPlacement 'center' / no bias): sit the hit area on- // the divider itself. Inline centering comes from rtlStyles.centerInline at- // the call site (correct in LTR and RTL); this block owns only the block axis.+ // The grab zone sits centred on the Handle whatever `pillPlacement` says,+ // which only places the pill. Inline centering comes from+ // rtlStyles.centerInline at the call site (correct in LTR and RTL); this+ // block owns only the block axis.hitAreaCenteredY: {insetBlockStart: '50%',transform: 'translateY(-50%)',},+ hitAreaWithinHandleX: {+ width: `min(${spacingVars['--spacing-4']}, 100%)`,+ },+ hitAreaWithinHandleY: {+ height: `min(${spacingVars['--spacing-4']}, 100%)`,+ },// Pill base — themes target .astryx-resize-handle-pill for size/shape.pill: {position: 'absolute',zIndex: 2,- pointerEvents: 'none',+ touchAction: 'none',+ userSelect: 'none',borderRadius: radiusVars['--radius-full'],backgroundColor: colorVars['--color-border'],transitionProperty: 'opacity, background-color, transform',@@ -216,6 +189,18 @@ const styles = stylex.create({transitionTimingFunction: easeVars['--ease-standard'],top: '50%',},+ pillGrabHorizontal: {+ cursor: {+ default: 'col-resize',+ ':is(:disabled,[aria-disabled="true"])': 'default',+ },+ },+ pillGrabVertical: {+ cursor: {+ default: 'row-resize',+ ':is(:disabled,[aria-disabled="true"])': 'default',+ },+ },pillHorizontal: {width: 3,height: spacingVars['--spacing-8'],@@ -224,59 +209,93 @@ const styles = stylex.create({width: spacingVars['--spacing-8'],height: 3,},- pillHidden: {opacity: 0},+ // A hidden pill paints nothing, so it takes no pointer either.+ pillHidden: {opacity: 0, pointerEvents: 'none'},pillVisible: {opacity: 1},pillHover: {opacity: 1,+ pointerEvents: 'auto',backgroundColor: colorVars['--color-border'],},pillActive: {opacity: 1,+ pointerEvents: 'auto',backgroundColor: colorVars['--color-border-emphasized'],},+ // A pill shown on hover can sit outside the Grab zone. This invisible+ // extension spans the gap toward the Handle, so the pointer keeps the hover+ // 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+ // translate, so the side toward the Handle is physical too.+ pillBridgeRight: {+ '::before': {+ content: '""',+ position: 'absolute',+ insetBlock: 0,+ insetInlineStart: {+ default: 0,+ ':is([dir="rtl"] *)': `calc(-1 * ${spacingVars['--spacing-1']} - 1px)`,+ },+ insetInlineEnd: {+ default: `calc(-1 * ${spacingVars['--spacing-1']} - 1px)`,+ ':is([dir="rtl"] *)': 0,+ },+ },+ },+ pillBridgeLeft: {+ '::before': {+ content: '""',+ position: 'absolute',+ insetBlock: 0,+ insetInlineStart: {+ default: `calc(-1 * ${spacingVars['--spacing-1']} - 1px)`,+ ':is([dir="rtl"] *)': 0,+ },+ insetInlineEnd: {+ default: 0,+ ':is([dir="rtl"] *)': `calc(-1 * ${spacingVars['--spacing-1']} - 1px)`,+ },+ },+ },+ pillBridgeDown: {+ '::before': {+ content: '""',+ position: 'absolute',+ insetInline: 0,+ insetBlockStart: 0,+ insetBlockEnd: `calc(-1 * ${spacingVars['--spacing-1']} - 1px)`,+ },+ },+ pillBridgeUp: {+ '::before': {+ content: '""',+ position: 'absolute',+ insetInline: 0,+ insetBlockStart: `calc(-1 * ${spacingVars['--spacing-1']} - 1px)`,+ insetBlockEnd: 0,+ },+ },});// Dynamic styles — avoids inline style overrides.// Each axis gets its own function since StyleX requires static structure.const dynamicStyles = stylex.create({- // Hit-area inline offset — mirrors the pill's `pillOffsetX`/`pillOffsetY`- // construction so the grab zone sits centred on the visible pill in BOTH- // directions. Both anchor at the divider's inline-start edge- // (`insetInlineStart: 0`) and travel toward the panel side with the SAME- // physical translate `dir * (gripWidth + gap)`, so they share the pill's- // near edge. The hit area is wider, so it also shifts by half the width- // difference `(16px − 3px) / 2 = 6.5px` to align the two CENTRES. That- // centring shift is along the inline axis (a box grows from its inline-start- // edge toward inline-end), so it must flip physical sign under RTL — unlike- // the `dir * (...)` travel, which is physical and identical in both- // directions because the pill's own offset is physical. Mixing the previous- // divider-relative `50%` anchor with a percentage translate stranded the grab- // zone to one side under RTL; this construction keeps it on the pill.- //- // Only the offset axis is translated. Unlike the pill — a small box anchored- // at the divider's midpoint, so it needs a −50% self-shift to centre — the- // grab zone is STRETCHED along the handle by hitAreaHorizontal/Vertical's- // 0/0 insets, so it is already in place on that axis. A percentage there- // would displace it by half the handle's own length, growing with the panel.- hitAreaOffsetX: (dir: number) => ({- insetInlineStart: 0,- transform: {- default: `translateX(calc(${dir} * (3px + ${spacingVars['--spacing-1']}) - 6.5px))`,- ':is([dir="rtl"] *)': `translateX(calc(${dir} * (3px + ${spacingVars['--spacing-1']}) + 6.5px))`,- },+ // An inline Handle's zone is centred on its line, so half of it reaches into+ // the pane.+ hitAreaLengthX: (pane: number) => ({+ width: `min(${spacingVars['--spacing-4']}, ${pane}px)`,}),- hitAreaOffsetY: (dir: number) => ({- insetBlockStart: 0,- transform: `translateY(calc(${dir} * (3px + ${spacingVars['--spacing-1']}) - 6.5px))`,+ hitAreaLengthY: (pane: number) => ({+ height: `min(${spacingVars['--spacing-4']}, ${pane}px)`,}),- pillOffsetX: (dir: number) => ({+ pillOffsetX: (dir: -1 | 1) => ({insetInlineStart: 0,transform: `translate(calc(${dir} * (100% + ${spacingVars['--spacing-1']})), -50%)`,}),// Vertical offset: no rotation — use explicit landscape dimensions.// Rotation + offset creates confusing coordinate math since translate// operates in pre-rotation local space.- pillOffsetY: (dir: number) => ({+ pillOffsetY: (dir: -1 | 1) => ({top: 0,transform: `translate(-50%, calc(${dir} * (100% + ${spacingVars['--spacing-1']})))`,}),@@ -333,7 +352,8 @@ export interface ResizeHandleProps extends Omit<isAlwaysVisible?: boolean;/**- * Which side of the divider line the pill sits on.+ * Which side of the divider line the pill sits on. It moves only the pill:+ * the grab zone stays centred on the divider.* - `'auto'` — panel side by default, flips when panel is collapsed to 0px* - `'start'` — left (horizontal) or top (vertical)* - `'end'` — right (horizontal) or bottom (vertical)@@ -468,9 +488,12 @@ export function ResizeHandle({isReversed,isCollapsed,);- // Physical offset direction shared by the pill and the grab zone (null =- // centered / no bias). Keeps the two positioned identically in LTR and RTL.- const hitBiasDir = hitAreaBiasDir(effectiveSide);+ // An inline zone reaches at most half of the pane the Handle resizes. An+ // overlay Handle takes at most half of it. A collapsed pane, or one at 0px,+ // has nothing to protect and keeps the whole zone.+ const paneSize = resizable?._size;+ const paneLength =+ isCollapsed || paneSize == null || paneSize <= 0 ? undefined : paneSize;const isInteracting = isHovered || isFocused;// A handle whose axis disagrees with its region drags along one axis while@@ -533,6 +556,35 @@ export function ResizeHandle({? t('@astryx.resizable.collapsed'): undefined;+ // The Grip pill takes the pointer as the Grab zone does, so a pill drawn+ // outside the zone still resizes.+ const grabHandlers: Pick<+ HTMLAttributes<HTMLDivElement>,+ | 'onPointerDown'+ | 'onPointerMove'+ | 'onPointerUp'+ | 'onPointerCancel'+ | 'onLostPointerCapture'+ | 'onPointerEnter'+ | 'onPointerLeave'+ > = {+ onPointerDown: e => {+ if (!isDisabled) {+ gesture?.pointerDown(e);+ }+ },+ onPointerMove: e => gesture?.pointerMove(e),+ onPointerUp: e => gesture?.pointerUp(e),+ onPointerCancel: e => gesture?.pointerCancel(e),+ onLostPointerCapture: e => gesture?.pointerCancel(e),+ onPointerEnter: () => setIsHovered(true),+ onPointerLeave: () => {+ if (!isDragging) {+ setIsHovered(false);+ }+ },+ };+return (<divref={useMergedRefs(ref, handleRef)}@@ -560,6 +612,11 @@ export function ResizeHandle({isOverlay && styles.overlay,isOverlay &&(isHorizontal ? styles.overlayHorizontal : styles.overlayVertical),+ isOverlay &&+ paneLength != null &&+ (isHorizontal+ ? styles.overlayHorizontalOnShortPane+ : styles.overlayVerticalOnShortPane),!isOverlay && (isHorizontal ? styles.horizontal : styles.vertical),!isOverlay &&!hasDivider &&@@ -594,34 +651,21 @@ export function ResizeHandle({{...stylex.props(styles.hitArea,isHorizontal ? styles.hitAreaHorizontal : styles.hitAreaVertical,- // Bias the grab zone to sit over the visible pill. When the pill is- // centered (no bias) just center the hit area on the divider; when- // it's offset to a panel side, reuse the pill's physical-offset- // construction so the two stay aligned in LTR and RTL alike.- hitBiasDir == null- ? isHorizontal- ? rtlStyles.centerInline('0px')- : styles.hitAreaCenteredY- : isHorizontal- ? dynamicStyles.hitAreaOffsetX(hitBiasDir)- : dynamicStyles.hitAreaOffsetY(hitBiasDir),+ isHorizontal+ ? rtlStyles.centerInline('0px')+ : styles.hitAreaCenteredY,+ isOverlay &&+ (isHorizontal+ ? styles.hitAreaWithinHandleX+ : styles.hitAreaWithinHandleY),+ !isOverlay &&+ paneLength != null &&+ (isHorizontal+ ? dynamicStyles.hitAreaLengthX(paneLength)+ : dynamicStyles.hitAreaLengthY(paneLength)),isDisabled && styles.disabled,)}- onPointerDown={e => {- if (!isDisabled) {- gesture?.pointerDown(e);- }- }}- onPointerMove={e => gesture?.pointerMove(e)}- onPointerUp={e => gesture?.pointerUp(e)}- onPointerCancel={e => gesture?.pointerCancel(e)}- onLostPointerCapture={e => gesture?.pointerCancel(e)}- onPointerEnter={() => setIsHovered(true)}- onPointerLeave={() => {- if (!isDragging) {- setIsHovered(false);- }- }}+ {...grabHandlers}/>{/* Pill grip indicator — themed via .astryx-resize-handle-pill */}{children ?? (@@ -640,11 +684,25 @@ export function ResizeHandle({: dynamicStyles.pillOffsetY(effectiveSide === 'start' ? -1 : 1,),+ isHorizontal+ ? styles.pillGrabHorizontal+ : styles.pillGrabVertical,isAlwaysVisible ? styles.pillVisible : styles.pillHidden,+ !isAlwaysVisible &&+ effectiveSide !== 'center' &&+ (isHorizontal+ ? effectiveSide === 'start'+ ? styles.pillBridgeRight+ : styles.pillBridgeLeft+ : effectiveSide === 'start'+ ? styles.pillBridgeDown+ : styles.pillBridgeUp),isInteracting && !isDragging && styles.pillHover,isDragging && styles.pillActive,+ isDisabled && styles.disabled,),)}+ {...grabHandlers}/>)}</div>diff --git a/packages/core/src/Resizable/__tests__/grabZone.interaction.browser.spec.ts b/packages/core/src/Resizable/__tests__/grabZone.interaction.browser.spec.tsnew file mode 100644index 0000000000..149d2161d0--- /dev/null+++ b/packages/core/src/Resizable/__tests__/grabZone.interaction.browser.spec.ts@@ -0,0 +1,294 @@+// Copyright (c) Meta Platforms, Inc. and affiliates.++/**+ * @file grabZone.interaction.browser.spec.ts+ * @input The "Core/Resizable / Grab Zone On Short Items" story in a real+ * browser: a 30-minute and a 15-minute calendar event at 48px an hour, each+ * moved by a drag on its body and resized by the ResizeHandle on its bottom+ * edge, for each `pillPlacement` and both `position`s+ * @output Checks that the Grab zone stays on the Handle whatever+ * `pillPlacement` says, and takes at most half of a short item, so the item+ * keeps its own drag, and that a drag on the Grip pill resizes the item+ * wherever the pill sits (component:Resizable FR1; the clamp follows+ * `spec:AST-094` FR42's grown targets that stop at half the gap)+ * @position Browser proof for ResizeHandle.tsx's Grab zone+ */++import {expect, test, type Page} from '@playwright/test';+import {openStory, withStorybook} from '@astryxdesign/interaction-harness';++const storybook = withStorybook(test);++const STORY = 'core-resizable--grab-zone-on-short-items';++type PillPlacement = 'auto' | 'start' | 'center' | 'end';+type Position = 'inline' | 'overlay';++interface Box {+ top: number;+ bottom: number;+ left: number;+ right: number;+}++interface Geometry {+ event: Box;+ handle: Box;+ zone: Box;+}++async function open(+ page: Page,+ pillPlacement: PillPlacement,+ position: Position,+): Promise<void> {+ await openStory(page, storybook(), STORY, {pillPlacement, position});+ await expect(page.getByTestId('thirty')).toBeVisible();+}++/** The event, its Handle (the separator) and its Grab zone, in page pixels. */+async function measure(page: Page, testId: string): Promise<Geometry> {+ return page.evaluate(id => {+ const event = document.querySelector<HTMLElement>(`[data-testid="${id}"]`);+ const handle = event?.querySelector<HTMLElement>('[role="separator"]');+ // The Grab zone is the Handle's first child: the invisible element that+ // takes the pointer.+ const zone = handle?.firstElementChild;+ if (event == null || handle == null || zone == null) {+ throw new Error(`no event, Handle or Grab zone for ${id}`);+ }+ const box = (element: Element) => {+ const rect = element.getBoundingClientRect();+ return {+ top: rect.top,+ bottom: rect.bottom,+ left: rect.left,+ right: rect.right,+ };+ };+ return {event: box(event), handle: box(handle), zone: box(zone)};+ }, testId);+}++/** How much of the event the Grab zone covers, on the resize axis. */+function overlap(geometry: Geometry): number {+ const {event, zone} = geometry;+ return Math.max(+ 0,+ Math.min(zone.bottom, event.bottom) - Math.max(zone.top, event.top),+ );+}++const PLACEMENTS: PillPlacement[] = ['auto', 'start', 'center', 'end'];++for (const pillPlacement of PLACEMENTS) {+ test(`the Grab zone stays on the Handle with pillPlacement="${pillPlacement}"`, async ({+ page,+ }) => {+ await open(page, pillPlacement, 'inline');+ for (const id of ['thirty', 'fifteen']) {+ const geometry = await measure(page, id);+ const handleCentre = (geometry.handle.top + geometry.handle.bottom) / 2;+ const zoneCentre = (geometry.zone.top + geometry.zone.bottom) / 2;+ expect(+ Math.abs(zoneCentre - handleCentre),+ `${id}: the Grab zone's centre against the Handle's`,+ ).toBeLessThanOrEqual(0.5);+ }+ });+}++for (const position of ['inline', 'overlay'] as const) {+ for (const pillPlacement of PLACEMENTS) {+ test(`a 30-minute and a 15-minute event keep at least half of themselves for their own drag (${position}, pillPlacement="${pillPlacement}")`, async ({+ page,+ }) => {+ await open(page, pillPlacement, position);+ for (const id of ['thirty', 'fifteen']) {+ const geometry = await measure(page, id);+ const height = geometry.event.bottom - geometry.event.top;+ expect(height, `${id}: the event's height`).toBeCloseTo(+ id === 'thirty' ? 24 : 12,+ 0,+ );+ expect(+ overlap(geometry),+ `${id}: how much of the event the Grab zone covers`,+ ).toBeLessThanOrEqual(height / 2 + 0.5);+ // The event's own drag answers just above the Grab zone, over its+ // whole upper half, except on the Grip pill, which resizes it.+ const x = (geometry.event.left + geometry.event.right) / 2;+ const free = await page.evaluate(+ ({id: testId, x: atX, from, to}) => {+ const body = document.querySelector(+ `[data-testid="${testId}-body"]`,+ );+ const pill = document+ .querySelector(`[data-testid="${testId}"]`)+ ?.querySelector('.astryx-resize-handle-pill')+ ?.getBoundingClientRect();+ const onPill = (y: number) =>+ pill != null &&+ atX >= pill.left &&+ atX <= pill.right &&+ y >= pill.top &&+ y <= pill.bottom;+ const missed: number[] = [];+ for (let y = from; y < to; y += 1) {+ const hit = document.elementFromPoint(atX, y);+ if (+ !onPill(y) &&+ (body == null || hit == null || !body.contains(hit))+ ) {+ missed.push(y);+ }+ }+ return missed;+ },+ {+ id,+ x,+ from: Math.ceil(geometry.event.top),+ to: Math.floor(geometry.event.top + height / 2),+ },+ );+ expect(+ free,+ `${id}: points of the event's upper half, off its Grip pill, not on its body`,+ ).toEqual([]);+ }+ });+ }+}++for (const position of ['inline', 'overlay'] as const) {+ for (const pillPlacement of PLACEMENTS) {+ test(`a drag on the Grip pill resizes the 30-minute event wherever the pill sits (${position}, pillPlacement="${pillPlacement}")`, async ({+ page,+ }) => {+ await open(page, pillPlacement, position);+ const event = page.getByTestId('thirty');+ const handle = page.getByRole('separator', {+ name: 'Resize the 30-minute event',+ });+ const pill = handle.locator('.astryx-resize-handle-pill');+ // The pill is present and painted before the drag.+ await expect(pill).toHaveCount(1);+ await expect(pill).toHaveCSS('opacity', '1');+ const box = await pill.boundingBox();+ if (box == null) {+ throw new Error('the Grip pill has no box');+ }+ expect(box.width * box.height, "the Grip pill's area").toBeGreaterThan(0);+ const x = box.x + box.width / 2;+ const y = box.y + box.height / 2;+ await page.mouse.move(x, y);+ await page.mouse.down();+ await page.mouse.move(x, y + 12, {steps: 4});+ await page.mouse.up();+ await expect(handle).toHaveAttribute('aria-valuenow', '36');+ await expect(event).toHaveAttribute('data-top', '24');+ });+ }+}++test('a drag on a 30-minute event moves it, and a drag on its Handle resizes it', async ({+ page,+}) => {+ await open(page, 'auto', 'inline');+ const event = page.getByTestId('thirty');+ const handle = page.getByRole('separator', {+ name: 'Resize the 30-minute event',+ });+ const before = await measure(page, 'thirty');+ const x = (before.event.left + before.event.right) / 2;+ // A third of the way down the event: its body, which moves it.+ const y = before.event.top + (before.event.bottom - before.event.top) / 3;+ await page.mouse.move(x, y);+ await page.mouse.down();+ await page.mouse.move(x, y + 24, {steps: 4});+ await page.mouse.up();+ await expect(event).toHaveAttribute('data-top', '48');+ await expect(handle).toHaveAttribute('aria-valuenow', '24');++ // On the Handle's line: the Grab zone, which resizes it.+ const moved = await measure(page, 'thirty');+ const lineY = (moved.handle.top + moved.handle.bottom) / 2;+ await page.mouse.move(x, lineY);+ await page.mouse.down();+ await page.mouse.move(x, lineY + 12, {steps: 4});+ await page.mouse.up();+ await expect(handle).toHaveAttribute('aria-valuenow', '36');+ await expect(event).toHaveAttribute('data-top', '48');+});++const HOVER_PILL_STORY = 'core-resizable--hover-pill-on-overlay-handle';++for (const [dir, pillPlacement] of [+ ['ltr', 'start'],+ ['rtl', 'end'],+] as const) {+ test(`a pill shown on hover beside an overlay Handle stays reachable from the Grab zone (${dir}, pillPlacement="${pillPlacement}")`, async ({+ page,+ }) => {+ await openStory(page, storybook(), HOVER_PILL_STORY, {dir, pillPlacement});+ const handle = page.getByRole('separator', {name: 'Resize sidebar'});+ await expect(handle).toBeVisible();+ const pill = handle.locator('.astryx-resize-handle-pill');+ const zoneBox = await handle.locator(':scope > *').first().boundingBox();+ if (zoneBox == null) {+ throw new Error('the Grab zone has no box');+ }+ // Hovering the zone shows the pill.+ await page.mouse.move(+ zoneBox.x + zoneBox.width / 2,+ zoneBox.y + zoneBox.height / 2,+ );+ await expect(pill).toHaveCSS('opacity', '1');+ const pillBox = await pill.boundingBox();+ if (pillBox == null) {+ throw new Error('the Grip pill has no box');+ }+ // The pill sits outside the zone, so the pointer crosses a gap to it.+ expect(+ pillBox.x >= zoneBox.x + zoneBox.width ||+ pillBox.x + pillBox.width <= zoneBox.x,+ 'the pill sits outside the Grab zone',+ ).toBe(true);+ const x = pillBox.x + pillBox.width / 2;+ const y = pillBox.y + pillBox.height / 2;+ // Rest in the gap between the zone and the pill, longer than any hover+ // grace, before reaching the pill.+ const gapX =+ pillBox.x >= zoneBox.x + zoneBox.width+ ? (zoneBox.x + zoneBox.width + pillBox.x) / 2+ : (pillBox.x + pillBox.width + zoneBox.x) / 2;+ await page.mouse.move(gapX, y);+ await page.waitForTimeout(300);+ await expect(pill).toHaveCSS('opacity', '1');+ await page.mouse.move(x, y);+ await expect(pill).toHaveCSS('opacity', '1');+ // The pill's hit area reaches only toward the zone. Just past its far+ // side, the pointer finds the pane, so a short item keeps its own drag.+ const farX =+ pillBox.x >= zoneBox.x + zoneBox.width+ ? pillBox.x + pillBox.width + 3+ : pillBox.x - 3;+ const isPillPastItsFarSide = await pill.evaluate(+ (element, [px, py]) => {+ const hit = document.elementFromPoint(px, py);+ return hit != null && (hit === element || element.contains(hit));+ },+ [farX, y],+ );+ expect(+ isPillPastItsFarSide,+ 'the pill takes no pointer past its far side',+ ).toBe(false);+ const before = await handle.getAttribute('aria-valuenow');+ await page.mouse.down();+ await page.mouse.move(x + (dir === 'ltr' ? 40 : -40), y, {steps: 4});+ await page.mouse.up();+ await expect(handle).not.toHaveAttribute('aria-valuenow', before ?? '');+ });+}diff --git a/packages/core/src/Resizable/shippedDirections.test.ts b/packages/core/src/Resizable/shippedDirections.test.tsindex 890d6796f2..8774e8f00c 100644--- a/packages/core/src/Resizable/shippedDirections.test.ts+++ b/packages/core/src/Resizable/shippedDirections.test.ts@@ -394,7 +394,7 @@ describe('shipped Resizable examples', () => {expect(pairings.filter(pairing => pairing.error != null)).toEqual([]);});- it('detects all six shipped vertical mismatches against the unfixed source shape', () => {+ it('detects all seven shipped vertical mismatches against the unfixed source shape', () => {const pairings = sourcePairings(source =>source.replace(/^\s*direction: 'vertical',\n/gm, ''),);@@ -402,7 +402,7 @@ describe('shipped Resizable examples', () => {pairing => pairing.handleDirection === 'vertical',);- expect(mismatches).toHaveLength(6);+ expect(mismatches).toHaveLength(7);expect(mismatches.every(pairing => pairing.error != null)).toBe(true);});