Skip to content

fix(table): a narrow header truncates its label so its sort and filter controls stay in the cell - #12312

Merged
josephfarina merged 4 commits into
mainfrom
rl-11-table-header-filter
Nov 17, 2026
Merged

josephfarina merged 4 commits into
mainfrom
rl-11-table-header-filter

Conversation

@josephfarina

@josephfarina josephfarina commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

User impact

In a Table with sorting and popover filtering, a column whose header label plus its controls is wider than the column pushes the filter button past the label's space. On a phone the button ends at or past the cell's edge, partly hidden and hard or impossible to tap, while the label never truncates.

Problem and solution fit

  • Why does the button leave its space? The header lays out [label][after controls] in an inline flex row with no width limit, and the label cannot shrink (it is a flex item that keeps its whole one-line width). The sort plugin's label span cannot shrink inside its button either. So the row grows past the cell and the trailing filter button is pushed out.
  • Why does it harm the task? Filtering a column on a phone means tapping that button.
  • Why does it matter? Header cells are documented to truncate their text; here the label wins and the control loses.

The fix bounds the label row to the header cell and lets the label give up width first; the sort button's label truncates the same way while its indicator keeps its size. Header content may still grow into the cell's own inline-end padding before anything truncates, so a label truncates only when the cell, padding included, truly cannot hold it, and the controls never cross the cell's edge. The header cell declares its inline inset once (--_table-header-inline) and derives both its padding and that room (--_table-header-end-room) from it; on the last column the room reads the container edge inset that containerEdgeStyles already declares (now also exposed as --_table-edge-inline-end). Every other cell resets that property, so a Table nested in a last-column cell does not inherit the outer cell's inset.

Expected behavior and authority

TableHeaderCell truncates its text (its record's FR2). Plugin header controls go in the after slot (Table FR11), so they belong inside the header cell.

Smallest restoration

  • table.stylex.ts: the last column's container edge inset is declared once as --_table-edge-inline-end, and its end padding reads it (same value as before); other cells set it to initial, so it does not inherit into a nested Table.
  • TableHeaderCell: its density inset is declared once as --_table-header-inline; padding and the content room --_table-header-end-room both derive from it (the room takes the edge inset on the last column).
  • BaseTable: when an after slot is present, the header label row is capped at the cell plus that room, and the label sits in a wrapper that may shrink and truncates.
  • Sort plugin: the button is at least the cell's content width and at most that plus the room; its label truncates and its indicator does not shrink.

Evidence

  • Reproduction before the change: a sortable, filterable Table header squeezed to 100, 80 and 64px puts the filter button 7, 25 and 40px past the cell's edge, where it cannot be tapped, and the label never truncates.
  • Result after the change: in the same squeezes the filter button ends exactly at the cell's edge, a hit test at both ends and the center lands on it, and the label truncates by just the width needed.
  • Representative unchanged path: every bundled template with a sortable or filterable Table header, at 1280 light and dark, 390 dark and 375 light: no label newly truncates, and the before/after header screenshots differ by at most 11 anti-aliased pixels.
  • Size (pnpm size:pages, first-load JavaScript gzip): docs +0 B, form +0 B, menu +0 B, table +121 B.
  • Known, not changed here: with column resize on and a mouse, the resize separator sits on the last 8px of a header cell, so in a squeezed column it overlaps part of a filter button that has grown into the end room. A truncated sortable label has no title; the cut-heading tooltip work covers keyboard focus.
  • Nested Table: a compact sortable, filterable Table in the last column of a balanced Table in a Card keeps its filter button inside its header cell (0px past the edge); without the reset it inherits the outer edge inset and ends 16px past.
  • Regression test or other mutation-sensitive proof: a new test in useTableFiltering.test.tsx renders a sortable, filterable header and checks the room on the cell, the row cap, the label's truncation and the sort indicator's fixed size, and a nested case checks that a cell resets the edge inset; each fails without its change.

Scope

Components: Table (TableHeaderCell, table.stylex, BaseTable header label row, useTableSortable)

  • One defect is restored.
  • Separable contradictory or unsettled tagalongs were removed or split.
  • No new public API, visual representation, default, or interaction model is hidden under the bug-fix label.
  • Public text and artifacts contain no internal Meta context.

Testing

  • vitest run packages/core/src/Table packages/core/src/theme/derivedVarRegistry.test.ts: all pass except one locale re-sort test in useTableSortableState.test.tsx, which fails the same way without this change on my machine (local locale data).
  • eslint, prettier and tsc on the changed files.
  • Real Chromium at 1280×900 (light and dark), 390×844 and 375×844: before/after header screenshots of every bundled template with sorting or filtering, a per-header check for newly truncated labels, and the squeeze measurements above.

@vercel

vercel Bot commented Nov 17, 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 Nov 17, 2026 1:07pm UTC

Request Review

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

astracat-bot Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 17, 2026, 1:12 PM UTC

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 17, 2026
@github-actions

github-actions Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 8a17c2b

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
TableRow 7.1 kB (0) · 4.0 kB CSS (+36 B) — ✓ · ✓ · ✗
TableBody 3.5 kB (0) · 3.3 kB CSS (0) — ✓ · ✓ · ✗
TableFooter 3.5 kB (0) · 3.3 kB CSS (0) — ✓ · ✓ · ✗
8 more components
Component Size LoC Visual · A11y · RTL
TableHeader 3.5 kB (0) · 3.3 kB CSS (0) — ✓ · ✓ · ✗
Markdown 204.5 kB (+150 B) · 22.1 kB CSS (+143 B) — — · — · —
Table 121.1 kB (+130 B) · 19.8 kB CSS (+133 B) — ✓ · ✓ · —
TableHeaderCell 103.8 kB (+70 B) · 19.1 kB CSS (+114 B) — ✓ · ✓ · ✓
lab/CommentThread 365.1 kB (+146 B) · 2.4 kB CSS (0) — — · — · —
lab/Comments 372.0 kB (+109 B) · 2.5 kB CSS (0) — — · — · —
TableCell 104.1 kB (+31 B) · 19.3 kB CSS (+43 B) — ✓ · ✓ · ✓
TableSelectionToolbar 76.3 kB (0) · 14.1 kB CSS (0) — ✓ · ✓ · ✓

Package size: @astryxdesign/core 7.63 MB packed (+1.3 kB); no new dependencies.

Touched components checked; for the full suites, add ci:run-visual for Visual, ci:run-a11y for Accessibility, ci:run-rtl for RTL.


Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested for one blocking finding; the fix itself works.

  • One shared path: headerEndRoomStyles (packages/core/src/Table/table.stylex.ts:114-133) declares the header cell's inline-end padding a second time (the density values from TableHeaderCell.tsx and the last-column containerEdgeStyles expression) instead of deriving padding and room from one source, so a later padding change that misses the copy pushes the filter button past the cell edge again; declare the end inset once (for example, set --_table-header-end-room where the padding is set and use paddingInlineEnd: var(--_table-header-end-room)) and delete the copies.

In Chromium the change does what it says: at 62 to 72 px columns the filter button now ends at the cell edge and a click at its start, centre and end reaches it (on main it sits up to 23 px outside), and wide-column frames are pixel-identical. Two non-blocking notes: with column resize on a mouse, the 8 px resize separator covers the last 8 px of the 12 px filter button, and a truncated sortable label has no title, unlike a plain header. Please also add the reference-page size deltas to the description (+107 B gzip on the table page, +0 B on the others).

Claims and files checked

Review mode: full; reason: no-earlier-review

  • Claim, release note: a narrow header truncates its label so its sort and filter controls stay in the cell and can be reached. Verified in Chromium; with column resize on a mouse only the first 4 px of the filter button are clickable.
  • Claim: before the change the filter button sits past the cell edge and the label never truncates. Verified, 1.8 to 23 px past the edge at 62 to 72 px columns.
  • Claim: after the change the button ends at the edge and clicks at both ends and the centre reach it. Verified without column resize.
  • Claim: bundled templates show no newly truncated label. Partly verified: four stories are pixel-identical at 1280 px; templates were not rechecked.
  • Claim: the new test fails without the change. Verified.
  • Claim: the Table unit tests pass. Verified, 894 passed.
  • Claim: lint, format and type checks pass on the changed files. Verified with eslint, prettier and the Core build.
  • Claim: the header cell publishes the end room, the label row is capped and its label wraps, and the sort label truncates while its indicator keeps its size. Verified at the cited lines.
  • Claim: no new public API. Verified; the API report lists no rows.
  • Claim: the header cell truncates its text and plugin controls go in the after slot. Verified against the current Table and TableHeaderCell records.
  • File .changeset/table-header-controls-stay-in-cell.md: clear.
  • File packages/core/src/Table/BaseTable.tsx: clear (non-blocking tooltip note).
  • File packages/core/src/Table/TableHeaderCell.tsx: part of the shared-path finding.
  • File packages/core/src/Table/table.stylex.ts: shared-path finding.
  • File packages/core/src/Table/plugins/sortable/useTableSortable.tsx: clear.
  • File packages/core/src/Table/plugins/filtering/useTableFiltering.test.tsx: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Table/table.stylex.ts Resolved
minWidth: 0,
// The row may use the header cell's inline-end padding, but not cross the
// cell's edge.
maxWidth: 'calc(100% + var(--_table-header-end-room, 0px))',

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.

Non-blocking: with useTableColumnResize, this cap puts the 12 px filter button flush with the cell edge, under the 8 px resize separator. In TableFiltering WithAllPlugins at 63 px columns, a mouse click at the button's centre or end lands on the separator (touch is fine, because the separator ignores coarse pointers). Stopping the row 8 px short when the header has an overlay, or lifting the after slot above the separator, would keep the whole button clickable.

const labelRow = isRenderable(after) ? (
<div {...stylex.props(styles.headerLabelRow)}>
{resolvedContent}
<span {...stylex.props(styles.headerLabel)}>{resolvedContent}</span>

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.

Non-blocking: a sortable label can now truncate to "N…", but headerTitleProp above sets title only when the content is a string, so a sortable header gets no tooltip while a plain header does. Falling back to the column's string header would keep the full name readable on hover.

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

Changes requested: the earlier shared-path finding is fixed, and two blocking findings plus one missing piece of evidence remain.

  • A sortable, filterable Table placed in another Table's last column inherits that cell's --_table-edge-inline-end (declared only on :last-child with default: null in packages/core/src/Table/table.stylex.ts:82-85, :96-99 and :110-113), so its header room exceeds its own padding and the filter button again ends past the cell edge (4 px for a compact table inside a balanced one in a Card); stop the inheritance, for example with default: 'initial', and add a nested case to the test.
  • Found by CI: packages/core/src/theme/derivedVarRegistry.test.ts:494 fails because --_table-header-end-room, --_table-header-inline and --_table-edge-inline-end are not listed in Table.doc.mjs theming.vars (or in that test's private-variable set).
  • Required evidence: the description should give the first-load gzip delta on the four reference pages from pnpm size:pages (docs, form and menu +0 B and table +114 B gzip in this review's build), since its "+220 B table page" figure is not that measure.

The top-level fix itself works in Chromium: at 62 px columns the filter buttons end exactly at the cell edge and clicks at their start, centre and end reach them, and wide headers are pixel-identical. The resize-separator overlap and the missing title on a truncated sortable label remain non-blocking.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Claim, release note: a narrow header's label truncates before its sort indicator and filter button, so those controls stay in the cell and can be reached. Verified for a top-level Table; false for a Table nested in another Table's last column.
  • Claim: before the change the filter button sits past the cell edge and the label never truncates. Verified at 62 px columns (11.8 to 23 px past the edge); the stated 100, 80 and 64 px figures were not re-measured.
  • Claim: after the change the button ends exactly at the cell edge and hits at both ends and the centre land on it. Verified for a top-level Table; false in the nested case (the end misses).
  • Claim: a label truncates only when the cell, padding included, cannot hold it, and the controls never cross the cell's edge. False in the nested case.
  • Claim: the header cell declares its inline inset once and derives padding and room from it; the last column's room reads the container inset, exposed once. Verified at the cited lines; the exposed inset also reaches nested non-last cells.
  • Claim: the last column's end padding keeps its value. Verified (12 px on both sides; the wide frame is identical).
  • Claim: the label row is capped and its label sits in a shrinking, truncating wrapper. Verified.
  • Claim: the sort button spans the cell plus its room, its label truncates and its indicator does not shrink. Verified.
  • Claim: bundled templates show no newly truncated label. Partly verified: one sortable, filterable story at 1280 px is pixel-identical; templates were not rechecked.
  • Claim: rendered reference pages grow 85 to 227 B gzip (table page +220 B). Not reproduced: the repository's reference-page tool gives table +114 B and +0 B on the other three pages.
  • Claim: the resize separator overlaps a grown filter button and a truncated sortable label has no title. Verified.
  • Claim: the new filtering test fails without the change. Verified.
  • Claim: the Table unit tests pass. Verified (894 passed); a theming-vars test outside the Table folder fails.
  • Claim: lint, format and type checks pass on the changed files. Verified (eslint, prettier, and the Core build).
  • Claim: no new public API. Verified (no API rows).
  • File .changeset/table-header-controls-stay-in-cell.md: clear.
  • File packages/core/src/Table/BaseTable.tsx: clear (non-blocking tooltip and resize notes).
  • File packages/core/src/Table/TableHeaderCell.tsx: nested-table room finding; theming-vars finding.
  • File packages/core/src/Table/table.stylex.ts: nested-table room finding; theming-vars finding.
  • File packages/core/src/Table/plugins/sortable/useTableSortable.tsx: clear.
  • File packages/core/src/Table/TableHeaderCell.test.tsx: clear.
  • File packages/core/src/Table/plugins/filtering/useTableFiltering.test.tsx: clear.

Automated review (maintainer link)

Comment thread packages/core/src/Table/table.stylex.ts Resolved

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

Approved pending CI: CI has not finished on this head yet.

The nested-table end room, the theming-vars registry check and the reference-page sizes from the last review are all fixed. At 62 px columns every filter button now ends exactly at its cell edge and stays clickable, in a nested Table too, and wide headers are pixel-identical. Two non-blocking notes stay open, both already named in the description: with column resize and a mouse the resize separator covers the end of a grown filter button, and a truncated sortable label has no title.

Claims and files checked

Review mode: incremental; reason: none

  • Changed rules (0): none.
  • Claim, release note: in a narrow column a header's label truncates before its sort indicator and filter button, so those controls stay inside the cell and can be reached. Verified at 62 px columns and in a Table nested in another Table's last column.
  • Claim: before the change the filter button sits at or past the cell edge and the label never truncates. Verified at 62 px columns (11.8 to 23 px past the edge, no hit reaches the button); the stated 100, 80 and 64 px figures were not re-measured.
  • Claim: on the base the label row has no width limit and neither the label nor the sort label can shrink. Verified in the base header row and sort button styles.
  • Claim: after the change the button ends exactly at the cell edge, and hits at both ends and the centre land on it. Verified.
  • Claim: a label truncates only when the cell, padding included, cannot hold it, and the controls never cross the cell edge. Verified (a label that fits keeps its full text; no control crosses an edge, nested tables included).
  • Claim: the header cell declares its inline inset once and derives its padding and room from it; the last column's room reads the container edge inset, declared once. Verified.
  • Claim: every other cell resets that inset, so a nested Table does not inherit the outer cell's value. Verified (the nested Name filter button ends at the cell edge; 7 px past it on the base).
  • Claim: the last column's end padding keeps its value. Verified (12 px on both sides; the wide frame is pixel-identical).
  • Claim: the label row is capped at the cell plus its room and the label sits in a shrinking, truncating wrapper. Verified.
  • Claim: the sort button spans at least the cell and at most the cell plus its room, its label truncates and its indicator does not shrink. Verified.
  • Claim: bundled templates show no newly truncated label. Partly verified: a sortable, filterable story at 1280 px is pixel-identical; the templates were not rechecked.
  • Claim: first-load gzip on the reference pages is docs, form and menu +0 B and table +121 B. Verified exactly.
  • Claim: without the reset a nested Table's filter button ends 16 px past its cell. Not reproduced at that figure (it depends on the outer inset); the fixed result is verified.
  • Claim: with column resize and a mouse the resize separator overlaps a grown filter button, and a truncated sortable label has no title. Verified; both stay non-blocking.
  • Claim: the new tests check the room, row cap, truncation, indicator size and the nested reset, and each fails without its change. Verified: both fail on the base and the nested test fails without the reset.
  • Claim: the Table and theming-vars unit tests pass apart from one locale test. Verified: all 1,049 pass, the locale test included.
  • Claim: eslint, prettier and tsc pass on the changed files. Verified.
  • Claim: no new public API. Verified (no API rows for Core or any theme).
  • File .changeset/table-header-controls-stay-in-cell.md: clear.
  • File packages/core/src/Table/BaseTable.tsx: clear (non-blocking tooltip and resize notes).
  • File packages/core/src/Table/TableHeaderCell.tsx: clear.
  • File packages/core/src/Table/table.stylex.ts: clear.
  • File packages/core/src/Table/plugins/sortable/useTableSortable.tsx: clear.
  • File packages/core/src/Table/TableHeaderCell.test.tsx: clear.
  • File packages/core/src/Table/plugins/filtering/useTableFiltering.test.tsx: clear.
  • File packages/core/src/theme/derivedVarRegistry.test.ts: clear.

Automated review (maintainer link)

@josephfarina
josephfarina merged commit 37db386 into main Nov 17, 2026
95 checks passed
@github-actions
github-actions Bot deleted the rl-11-table-header-filter branch November 18, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 8a17c2be Deployed Nov 17, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant