Repository navigation
fix(Table) useTableColumnResize: stop handles overhanging the table, reveal them on header hover - #6194
Conversation
… 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]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression19 of 436 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
cixzhang
left a comment
There was a problem hiding this comment.
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]
|
AI review status for this pull request.
|
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.
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.
|
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 changedPointer capability gates the reveal, not the control — 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 Focus emphasizes one boundary — already true (the row hint is Sticky columns and resize stop fighting — both style the same header cell and both set I'd said on #6232 that we'd enforce sticky-after-resize in Table's plugin order. That was wrong, and Spec updates on #6232Six 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
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
left a comment
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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]
* 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]>
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-ytoautoas soon asoverflow-xis. 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.
The
ResizeObserverthat 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-hintwhile 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:
Two details worth calling out:
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 aredisplay:noneregardless.Testing
vitest run packages/core/src/Table packages/core/src/theme/derivedVarRegistry.test.ts— 27 files, 645 tests, all passingtsc --noEmitonpackages/core— cleanScreenshots were taken by swapping this one file between its
mainversion 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