Skip to content

fix(Table) useTableColumnResize: stop handles overhanging the table, reveal them on header hover - #6194

Merged
ernestt merged 5 commits into
mainfrom
core-column-resize-scroll
Oct 9, 2026
Merged

ernestt merged 5 commits into
mainfrom
core-column-resize-scroll

Conversation

@ernestt

@ernestt ernestt commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

Two changes to the column-resize drag handles. They ship together because they come from the same piece of geometry: where a handle starts, and how far it runs.

The fix — handles overhang, so the table scrolls vertically for no reason

The handles deliberately span the whole table, not just the header, so the indicator line reads down through the body rows while you drag. They were given the table's full height (--table-resize-height) but they hang from their own cell's content box, which sits a few pixels below the table's top edge. Full height, starting a few pixels down, means each handle ends a few pixels past the last row.

That would be harmless if the wrapper could not scroll, but the wrapper exists to scroll horizontally, and CSS promotes overflow-y to auto as soon as overflow-x is. So the overhang turned into ~6px of vertical scrolling on tables that had no reason to scroll at all.

The overhang itself is invisible — a handle at rest is transparent — so the symptom is all you ever see. Both shots below drive the wrapper to its scroll bottom and crop its top edge. Before, it travels 6px and the card's top border and corner ride out of frame; after, the same command moves nothing.

before — scrolls 6px after — nothing to scroll
before after

The ResizeObserver that already measures the table now also measures how far the handles start below its top edge and publishes it as --table-resize-offset, which the handles subtract from their height.

The drop is per-cell rather than uniform — a handle hangs from its cell's content box, and the header's vertical centring shifts that box by an amount that depends on how tall each header's own content is. So the largest drop is published: a handle stopping a fraction short of the last row is invisible, whereas one hanging past it is not.

Reading the handles from inside the observer cannot feed back into it — they are absolutely positioned, so their height never moves the table.

The feature — a resizable column now says that it is

A boundary was only drawn once the pointer was already inside a handle's 8px hit area. You had to already suspect a column was resizable in order to discover that it was.

The header row now publishes --resize-hint while it is hovered, and the handles read that as their resting colour. Entering the header anywhere reveals every boundary at border weight; the handle under the pointer still goes to accent.

Identical crops, pointer resting on the second header cell in both:

before — nothing to find after — every boundary is drawn
before after

Two details worth calling out:

  • Hover is caught on the row, not the cell, so entering the header reveals all boundaries at once rather than only the one you happen to be over.
  • The handle reads the hint as its default value rather than matching the row's hover from inside the handle. That is deliberate: an ancestor selector (stylex.when.ancestor) would outrank the handle's own same-element :hover, and the handle under the pointer would never reach accent. Inheritance keeps that override at normal specificity.

Pointer-only, behind @media (hover: hover) — there is no hover to lead with on touch, where the handles are display:none regardless.

Testing

  • vitest run packages/core/src/Table packages/core/src/theme/derivedVarRegistry.test.ts — 27 files, 645 tests, all passing
  • tsc --noEmit on packages/core — clean
  • eslint — clean
  • Measured in-browser: vertical overflow in the scroll wrapper goes from ~6px to 0, with handle bottoms landing at or just above the last row

Screenshots were taken by swapping this one file between its main version and this branch's against the same running page, so the two crops in each pair differ only by the change. The theme in use neutralises the accent family to grey, so the accent state of the hovered handle is not separable from its neighbours in a still — it is left out rather than shown misleadingly.

Made with Cursor

… them on header hover

Two things about the drag handles, both from the same geometry.

The fix: the handles span the whole table so their indicator reads down
through the body rows, but they were given the table's full height while
hanging from a point a few pixels below its top edge, so each ended that far
past the last row. The scroll wrapper only exists to scroll horizontally, but
CSS promotes overflow-y to auto as soon as overflow-x is, so the overhang
became ~6px of vertical scrolling on a table with no reason to scroll. The
observer that already measures the table now also measures how far the handles
start below its top edge and publishes it as --table-resize-offset, which the
handles subtract. The drop is per-cell, so the largest is published: stopping a
fraction short of the last row is invisible, hanging past it is not.

The feature: a boundary was only drawn once the pointer was already inside a
handle's 8px hit area, so a resizable column gave no sign it could be resized.
The header row now publishes --resize-hint while hovered and the handles read
it as their resting colour, so entering the header reveals every boundary at
border weight. Reading it as the default rather than matching the row's hover
from inside the handle is deliberate: an ancestor selector would outrank the
handle's own :hover and the one under the pointer would never reach accent.

Co-authored-by: Cursor <[email protected]>
@vercel

vercel Bot commented Sep 9, 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 7, 2026 7:22pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 9, 2026
@github-actions github-actions Bot added the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Sep 9, 2026
github-actions Bot added a commit that referenced this pull request Sep 9, 2026
@github-actions

github-actions Bot commented Sep 9, 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

19 of 436 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 155,733
Chat Full AI Chat probe dark 155,005
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,229
Chat With Attachments probe dark 11,065
SideNav Resizable in AppShell probe light 3,208
Markdown Default probe dark 897
Markdown Default probe light 897
Markdown Default neutral dark 882
Markdown Default neutral light 858
FileInput Default neutral light 44
FileInput Default neutral dark 42

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

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

Thanks — showing every resize boundary on header hover is the intended design, but it changes what mouse users see across the whole header and needs to be recorded as Table’s current contract first.

Could you send that as a separate, design-only spec PR with no API changes, then rebase this PR onto it? We can approve that narrow spec update, and review the geometry change here once it lands.

[Reviewed by Robohands]

@astracat-bot

astracat-bot Bot commented Sep 9, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Oct 9, 2026, 9:49 PM UTC

@ernestt ernestt changed the title [fix][feat] useTableColumnResize: stop handles overhanging the table, reveal them on header hover fix(Table) useTableColumnResize: stop handles overhanging the table, reveal them on header hover Sep 11, 2026
@ernestt
ernestt requested a review from cixzhang September 11, 2026 17:38
Implements the decisions recorded on the spec in #6232:

- Pointer capability gates the reveal, not the control. The handle no
  longer disappears on a coarse primary pointer, so a tablet with a
  keyboard keeps its tab stop; coarse pointers get pointer-events: none
  instead, since touch-dragging a hairline boundary is not a supported
  path.
- Disclosure holds while the scroll region scrolls and resumes when it
  settles, so a boundary arriving under a still pointer is not read as
  intent. One passive scroll listener writes an inline custom property
  the header row and handles inherit; scrollend clears it where
  supported, a single settle timeout where it is not. No React state,
  no rerender.
- Focus emphasizes its own boundary and never raises the row-level hint.
- Sticky columns now writes position inline, where its offsets already
  were, so a pinned column stops depending on plugin insertion order to
  beat the resize plugin's position: relative.
ernestt added a commit that referenced this pull request Sep 21, 2026
Implementing the decisions in #6194 changed two of them:

- The sticky collision is fixed by writing position inline rather than
  by ordering the plugins. component:Table treats plugin order as a
  layout decision and explicitly refuses to let it decide correctness,
  so a pair that works in one order and breaks in the other is a defect
  in the pair. No companion Table FR9 change is needed.
- PR1's listener budget now names the settle signal the gate actually
  needs: scrollend where the browser has it, one debounced timer where
  it does not.
@ernestt

ernestt commented Sep 21, 2026

Copy link
Copy Markdown
Contributor Author

Pushed a third commit implementing the review decisions recorded on the spec in #6232. The two original changes in this PR are untouched; everything below is new.

What changed

Pointer capability gates the reveal, not the control — @media (pointer: coarse) was display: none on the handle, which removed the separator from the accessibility tree along with the pointer target. A tablet with a keyboard attached lost column resize entirely, while the plugin's keyboard path, accessible name, and value bounds all went on promising it. The handle now stays rendered and focusable wherever any input can drive it, and coarse pointers get pointer-events: none instead — an invisible 8px strip that swallows header touches is worse than no target, and touch-dragging a hairline boundary is not a path this plugin supports.

Disclosure holds while the region scrolls — horizontal scrolling drags columns under a stationary pointer, and a boundary arriving there hasn't been asked for. One passive scroll listener writes --resize-hint-gate inline on the scroll wrapper, which the header row and handles inherit; scrollend clears it where the browser has it, a single debounced timeout where it doesn't. No React state and no rerender — there's a render-count test holding that. The gate covers the pointer-on-boundary accent as well as the row hint, for the same reason. Focus is deliberate, so it's ungated.

Focus emphasizes one boundary — already true (the row hint is :hover-only, never :focus-within), so this is a test and a comment locking the behavior rather than a change.

Sticky columns and resize stop fighting — both style the same header cell and both set position: resize needs relative to anchor its handle, sticky needs sticky to pin. Sticky's went through a StyleX class while its offsets were already inline, so the two landed in the same style array and the later plugin won — a pinned column silently stopped pinning depending on the order the caller wrote plugins={{ ... }}.

I'd said on #6232 that we'd enforce sticky-after-resize in Table's plugin order. That was wrong, and PLUGIN_ORDER's own comment says why: "It must never decide whether the table works: a plugin that renders in one order and crashes in the other is broken, and adding it here buys a lucky order rather than a fix." Sticky now writes position inline alongside the offsets it was already writing there — which is what its own comment already claimed it did. Order-independent, and no Table FR9 change.

Spec updates on #6232

Six threads answered and the record updated to match: DEC-3 (modality split), DEC-4 (touch-drag a non-goal, closing OQ3), DEC-5 (focus scope), DEC-6 (scroll gate), DEC-7 (no theme target, closing OQ2). FR6 and FR8 rewritten, FR9 and FR10 added, ORD0 and an ORD1 clause, AR6, and PR1 amended to permit exactly the one listener plus its settle signal.

Two decisions moved after implementation, and #6232 was corrected rather than left describing an intent the code doesn't match: the sticky fix above, and PR1's budget naming the settle signal the gate actually needs.

Validation

  • packages/core/src/Table — 553 passing across 26 files, including 5 new disclosure tests and 3 new composition tests mounting resize + sticky in both insertion orders
  • tsc --noEmit, ESLint, Prettier, and the full pnpm check:* gate clean

Not covered: the browser and assistive-technology evidence the spec's verification map already tracks as pending. The coarse-pointer change is a CSS media resolution, so JSDOM can't assert it — it needs a real touch-primary device. Stale sticky pin offsets after a drag are untouched and recorded as OQ5.

@humbertovirtudes humbertovirtudes 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.

Resize offset invalidation only tracks the Table border box, so descendant-only handle or header geometry changes can restore the overflow defect. Header-hover disclosure and sticky-column composition also lack current authority and exact-head browser evidence for coarse pointers, keyboard focus, hover, and scroll settle. Please separate and own those contracts, cover geometry invalidation, and provide the browser evidence before approval.

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

Thanks for the detailed geometry work — the offset correction for the handle overhang is well targeted.

Approval is waiting on a maintainer spec decision. The header-hover reveal of every resize boundary (with its scroll gate), the coarse-pointer and focus behavior around it, and the order-independent resize/sticky composition are new public behavior that the current Table contract does not yet record. A maintainer needs to land or approve the pending column-resize module record in PR #6232 — or identify a different current record — covering the hover disclosure and scroll gate, coarse-pointer/keyboard behavior, focus scope, indicator extent, and resize/sticky composition, before those parts can be approved here.

Two independent items will still need attention after that decision:

  • The measured offset is only refreshed when the table itself resizes, so adding resize handles or changing header geometry at the same table size can leave a stale offset and bring back the stray vertical scroll. Please refresh it when those inputs change and add a same-size rerender regression test.
  • The pointer, touch, and keyboard-focus behavior needs real-browser evidence (coarse pointer, :focus-visible, and scroll settle), which unit tests in JSDOM cannot provide.

[Automated review]

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

Thanks for the detailed geometry work — the offset correction for the handle overhang is well targeted.

Approval is waiting on a maintainer spec decision. The header-hover reveal of every resize boundary (with its scroll gate), the coarse-pointer and focus behavior around it, and the order-independent resize/sticky composition are new public behavior that the current Table contract does not yet record. A maintainer needs to land or approve the pending column-resize module record in PR #6232 — or identify a different current record — covering the hover disclosure and scroll gate, coarse-pointer/keyboard behavior, focus scope, indicator extent, and resize/sticky composition, before those parts can be approved here.

Two independent items will still need attention after that decision:

  • The measured offset is only refreshed when the table itself resizes, so adding resize handles or changing header geometry at the same table size can leave a stale offset and bring back the stray vertical scroll. Please refresh it when those inputs change and add a same-size rerender regression test.
  • The coarse-pointer and touch behavior needs real-browser evidence on a touch-primary device, which unit tests in JSDOM cannot provide.

[Automated review]

@github-actions github-actions Bot removed the needs:code-review High-risk change (new package/component/API) — needs human code review before merge label Oct 7, 2026
@ernestt
ernestt dismissed stale reviews from humbertovirtudes and cixzhang October 9, 2026 21:48

Abandoning

@ernestt
ernestt merged commit 6e0d7a8 into main Oct 9, 2026
53 of 54 checks passed
ernestt added a commit that referenced this pull request Oct 9, 2026
* docs(Table): define the column-resize disclosure contract

Creates module:Table/useTableColumnResize and records what a resize
boundary looks like before anyone drags it: hidden at rest, every
boundary in the header row hinted while a hover-capable pointer is
inside it, accent for the boundary under the pointer, focused, or being
dragged. Bounds the indicator to the table it belongs to, bounds what
else header hover may change, and keeps the affordance pointer-only.

No API, DOM, target, or accessibility change.

* docs(Table): record review decisions on the column-resize disclosure contract

Settles the six review threads as decisions rather than open questions:

- DEC-3 splits the modality gate: pointer capability gates the hover
  reveal, not the control, so a coarse-primary device with a keyboard
  keeps its tab stop. Resolves the FR6/FR8 contradiction.
- DEC-4 records touch-drag resize as a non-goal, closing OQ3.
- DEC-5 keeps focus emphasizing one boundary without firing the row hint.
- DEC-6 suppresses disclosure while the scroll region scrolls; PR1 is
  amended to permit one passive, non-rendering scroll listener.
- DEC-7 records no public theme target, closing OQ2.

Also names the sticky-columns ordering dependency and its stale pin
offsets, and records the two known proportional-width defects as targets
for the follow-up width contract.

* docs(Table): correct the sticky dependency and the scroll-gate budget

Implementing the decisions in #6194 changed two of them:

- The sticky collision is fixed by writing position inline rather than
  by ordering the plugins. component:Table treats plugin order as a
  layout decision and explicitly refuses to let it decide correctness,
  so a pair that works in one order and breaks in the other is a defect
  in the pair. No companion Table FR9 change is needed.
- PR1's listener budget now names the settle signal the gate actually
  needs: scrollend where the browser has it, one debounced timer where
  it does not.

* docs: add column-resize contract changeset

* chore: keep spec-only change release-neutral

---------

Co-authored-by: Ernest <[email protected]>
@github-actions
github-actions Bot deleted the core-column-resize-scroll branch October 10, 2026 06:22

This branch was successfully deployed

1 active deployment
Preview — 1ce70b3d Deployed Oct 7, 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.

4 participants