Repository navigation
fix(table): a narrow header truncates its label so its sort and filter controls stay in the cell - #12312
Conversation
…r controls stay in the cell
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| 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
…included, cannot hold it
There was a problem hiding this comment.
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 fromTableHeaderCell.tsxand the last-columncontainerEdgeStylesexpression) 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-roomwhere the padding is set and usepaddingInlineEnd: 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.
| 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))', |
There was a problem hiding this comment.
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> |
There was a problem hiding this comment.
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.
…padding and its content room
There was a problem hiding this comment.
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-childwithdefault: nullinpackages/core/src/Table/table.stylex.ts:82-85,:96-99and: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 withdefault: 'initial', and add a nested case to the test. - Found by CI:
packages/core/src/theme/derivedVarRegistry.test.ts:494fails because--_table-header-end-room,--_table-header-inlineand--_table-edge-inline-endare not listed inTable.doc.mjstheming.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.
There was a problem hiding this comment.
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.
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
[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.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 thatcontainerEdgeStylesalready 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
TableHeaderCelltruncates its text (its record's FR2). Plugin header controls go in theafterslot (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 toinitial, 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-roomboth derive from it (the room takes the edge inset on the last column).BaseTable: when anafterslot 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.Evidence
pnpm size:pages, first-load JavaScript gzip): docs +0 B, form +0 B, menu +0 B, table +121 B.title; the cut-heading tooltip work covers keyboard focus.useTableFiltering.test.tsxrenders 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)
Testing
vitest run packages/core/src/Table packages/core/src/theme/derivedVarRegistry.test.ts: all pass except one locale re-sort test inuseTableSortableState.test.tsx, which fails the same way without this change on my machine (local locale data).eslint,prettierandtscon the changed files.