Repository navigation
fix(core): a pinned table column draws its own row dividers - #8654
Conversation
With collapsed borders the table paints every border at its cell's static place. A sticky cell moves and its border does not, so the line under a pinned column was whichever scrolled cell's border passed beneath it, and went missing where that cell drew none. The pinned cell's ::before, already the row overlay's layer, now reaches the bottom of the cell's border area, covers what the table painted there with the pinned base, and draws the divider itself. The row divider reads three custom properties, --table-row-divider-width, -style and -color, on body and header cells alike; the real border and the pinned divider read the same ones, so a theme sets them in one place. An app that styles a cell's or row's border-bottom directly is read once on mount and on resize (the collapsed winner of the cell's and row's border) and the pinned divider takes it. Static rendering is pixel-identical to before at rest and scrolled. Tests: a cross-browser spec checks the pinned divider matches its row at rest and scrolled, survives a scrolled cell with no border, and carries a theme's color and an app's row border; a story shows both.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
The row divider adds no theming API: cells keep their border tokens, and the pinned divider reads private plumbing only. --_table-row-divider-width is the width a cell's divider draws (0 on the last body row), and --_table-row-divider-app-width, -style and -color carry a border an app or theme sets on a cell or row directly, read on mount and on resize. The story themes the border through the existing --color-border token, and the Changeset describes the fix alone.
PR Analysis Report
|
There was a problem hiding this comment.
Changes requested: the pinned-column divider fix itself works, but two things need fixing before it can merge.
- Start the Changeset body with a
[fix]tag and add a contributor line such as@cixzhang, sincepnpm check:changesetscurrently fails the lint job. - Make the theme and app-border browser test compare every pixel of the sampled column, because it still passes when
syncPinnedDividersis removed.
Also, in dark mode the line under the pinned column is now slightly darker than the rest of the row, so the description's "pixel-identical" note holds in light mode only.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| Table: a pinned column (`useTableStickyColumns`) now draws its own row dividers, so the line under it no longer goes missing while the table scrolls horizontally. A theme's border color and an app's own `border-bottom` on a row or cell carry onto the pinned cells. |
There was a problem hiding this comment.
pnpm check:changesets fails the lint job on this body: it needs a category tag and a contributor credit (spec:AST-017 FR7). Start it with [fix] Table: … and add @cixzhang on its own line after it.
| const app = await dividerPixels(page, 1); | ||
| expect(near(app.pinned, app.unpinned, 24), `app at ${left}px`).toBe(true); | ||
| expect(app.pinned[0], `app at ${left}px is red`).toBeGreaterThan( | ||
| app.pinned[2] + 60, | ||
| ); |
There was a problem hiding this comment.
This passes even with the syncPinnedDividers(el) call removed: the pinned line is then 1 px of the theme's blue over 1 px of the app's red, and dividerPixels keeps only the darkest pixel, which is red. Returning all six samples and requiring pinned.every((rgb, i) => near(rgb, unpinned[i], 24)) would make it fail in that case.
| /** | ||
| * Where an app styles a cell's or row's `border-bottom` directly, past the | ||
| * custom properties, the pinned divider takes the border the table paints. | ||
| * Read on mount and on resize, never on scroll. |
There was a problem hiding this comment.
Nit: this also runs on every Table render, not only on mount and resize. transformScrollWrapper returns a new merged ref each render, so React re-attaches it and resize() runs again, which is how a render that changes a cell's or row's border without resizing the wrapper reaches the pinned divider. Worth saying here so the timing is not lost if that ref is ever stabilised.
|
/approve-spec cc491f7 |
…ts test compares every pixel CodeBunny on #8654: - The scroll container's merged ref was rebuilt on every render, so React re-attached it and re-read every pinned cell's border each render. One merged ref per inner ref now: the scroll listeners, the resize observer and the pinned dividers' read run on mount and on resize. - The theme and app border browser test compared only the darkest pixel, which a pinned line of the theme's blue over the app's red still passed. It compares the whole sampled column now. - The Changeset carries its category and credit.
There was a problem hiding this comment.
Changes requested: the pinned divider fixes the missing line and matches the row's border at mount, but two regressions need fixing before this can merge.
- A row or cell border that changes after mount, such as a row highlighted on click, is never re-read, so the pinned column keeps the old line while the rest of the row updates (
component:TableFR14); please re-read after each commit and add a browser test that changes a border after mount. - Caching the merged scroll-wrapper ref stopped the edge shadows from updating on render, so after columns are added the end shadow stays off until the user scrolls; please recompute on content changes, for example by also observing the table, and cover it with a test.
[Automated review]
| /** | ||
| * Where an app styles a cell's or row's `border-bottom` directly, past the | ||
| * custom properties, the pinned divider takes the border the table paints. | ||
| * Read on mount and on resize, never on scroll. |
There was a problem hiding this comment.
This read runs only when the wrapper's ref attaches and when the wrapper resizes, and the cached ref further down means no later render re-attaches it. A border that changes after mount without a size change (a row highlighted on click, a selection style, a light/dark switch on a non-token override) is never re-read, so the pinned band keeps painting the old value over the row's real border, while component:Table FR14 asks the pinned divider to keep "any app override … so customizations still show". In a fixture where a button sets row 2's cell borders to red through React state, the pinned cell keeps (235,235,235) while the rest of the row is (220,38,38). Re-running this after each commit (for example from a layout effect in the hook) and a browser test that changes a border after mount would cover it.
| const existingRef = props.htmlProps.ref ?? null; | ||
| const cached = mergedScrollWrapperRef.current; | ||
| const mergedRef = | ||
| cached != null && cached.inner === existingRef |
There was a problem hiding this comment.
Reusing the merged ref also removes the per-render re-attach that re-ran update(), so the edge shadows now refresh only on scroll and wrapper resize. When a render adds columns without resizing the wrapper, --table-sticky-shadow-end stays 0 with 360 px hidden behind an end-pinned column, where the base sets 1. Observing the <table> with the same ResizeObserver, or calling update after each commit, would keep the stable ref without the regression.
…nly mount and resize CodeBunny on #8654: - A border that changed after mount without a resize (a row highlighted on click) never reached the pinned cells. The plugin now re-reads them after each commit, every read before any write, writing a cell only when what it carries changes. - The stable merged ref left the edge shadows refreshing only on scroll and wrapper resize, so columns added without a resize left the end shadow off. The resize observer watches the table too, and the shadows refresh after each commit. New story PinnedDividersLive and two browser tests: a border set through React state after mount reaches the pinned cell at rest and scrolled, and the end shadow turns on when columns are added. Both checked in real Chromium (green 22,163,74 under pinned and unpinned cells alike; the end shadow 0, then 1).
There was a problem hiding this comment.
Changes requested: the pinned divider now follows borders set at mount or changed by the owning component's render, and the edge shadow follows added columns, but two component:Table FR14 gaps remain under the pinned column.
- A border that changes without a re-render of the component that calls the hook, such as a
:hoverrule or a colour-scheme switch after a row was expanded and collapsed, keeps the old line under the pinned column; please let the band follow the cell's own border in CSS (for exampleinheriton the::before), stop copying the token value once the token border wins again, and add browser tests for both cases. - A wider
border-topon the next row wins the collapse but is never read, so the pinned column shows the 1 px token line over it; please include the next row's top borders in the collapse and cover it with a test.
[Automated review]
| // After each commit: a border that changed with the render (a row | ||
| // highlighted on click) reaches the pinned divider, and the edge shadows | ||
| // follow content that changed without a resize. | ||
| useLayoutEffect(() => { |
There was a problem hiding this comment.
This refresh runs only when the component that calls the hook commits (and on a resize), but the ::before band covers the table's own border all the time, so a border that changes any other way stays hidden under the pinned column. With a red tbody tr:hover td { border-bottom-color } rule, the hovered row's line turns red everywhere except under the pinned cell, whose ::before keeps 1px solid rgba(0, 0, 0, 0.08); and after a row is expanded and collapsed its pinned cells carry the computed light token, which they keep through a colour-scheme switch above the table's owner, so that row loses its line in dark mode. component:Table FR14 asks the pinned divider to keep "any app override on tr, tbody or td borders". Letting the ::before take the cell's own border colour and style with inherit, and removing the inline variables when the token border wins again, would cover both without a read.
| * where an app styles the row and the row's wins the collapse (wider, then | ||
| * the stronger style; the cell wins a tie). | ||
| */ | ||
| function collapsedBottom(cell: Element): BottomEdge { |
There was a problem hiding this comment.
The edge under a row also collapses with the next row's border-top (its cells' and the row's), which this never reads. With border-top: 3px solid rgb(22, 163, 74) on row 3's cells in PinStart, the table paints a 3 px green edge, and under the pinned column the band draws its 1 px token line over the top third of it, at rest and scrolled. Including the next row's top borders here and sizing the band to the collapsed width would match what the table paints.
…carries only what wins over it CodeBunny on #8654: - A border that changed without a re-render of the hook's owner (an app's :hover rule, a colour-scheme switch after a carried border went away) stayed old under the pinned column. The pinned cell's ::before now inherits the cell's own border colour and style, so the cell's border, token or app rule, reaches it in CSS. Only a border that wins the collapse over the cell's own is carried (the cell's carry state), and the carry is dropped once the cell's own wins again. - The collapse now includes the next row's top border (its cell's and the row's), so a wider top border on the next row shows under the pinned column at its full width. Browser tests: a :hover rule's colour, a carry dropped after a highlight is undone, and the next row's 3 px top border, under the pinned cell as under the rest of the row. Checked in real Chromium at rest and scrolled 150 px, with the earlier theme, app-row and pin-start checks.
…, a stable scroll ref, browser checks Merges #8654's carry state and next-row collapse; the shared collapse helper lives in glidingDivider.ts. While a row glides, a pinned cell's ::before draws the row's carried divider (its own border is transparent). CodeBunny on #8656: - A panel that was the last row kept a 0 px divider once rows followed: the carry read the panel cell's own width. The panel now takes its row's cell colour and style, and a width only when the row's own border wins; otherwise its width value is 'initial', so it keeps its own. - A table nested in an open panel took the outer row's colour: every divided cell read the panel variable. Only the panel cell reads it now, and the values sit on the panel cell, each always written, so a panel nested in another never inherits that one's. - transformScrollWrapper built a new merged ref every render; it is kept per inner ref, as the sticky plugin does. - New browser spec TableRowGlide (Table FR14, FR15): no animation without a handle; mid-glide, a divider under the moving row's pinned and unpinned cells; column widths unchanged through a glide; an open panel's divider. Run against the built stories in real Chromium, three times.
There was a problem hiding this comment.
Changes requested: pinned columns now keep their row dividers through horizontal scrolling and carry theme and app borders, the detail panel carries its row's divider, and the registry test and the repeated per-commit read with column resize are fixed. One case regressed in this revision: when the table mounts from state below the component that calls useTableStickyColumns (an uncontrolled tab, disclosure or dialog, say), the pinned cells never read a winning row border, so the pinned column draws the 1 px token line over an app's 2 px row border until the pointer crosses the row. Please read the pinned dividers once after an attach that the owner's after-commit refresh does not follow (for example when PinnedDividerModeWatch mounts), and add a browser test that reveals the table from state below the hooks' owner.
[Automated review]
| // The pinned dividers are read after the commit that attached this | ||
| // (the refresh layout effect below), not here as well. | ||
| update(); |
There was a problem hiding this comment.
Moving the read off the attach assumes the hook owner's after-commit effect (line 553) follows every attach. A table mounted from state below that owner (an uncontrolled tab, disclosure or dialog) attaches in a commit without it, and the observer's first callback skips the read too, so the pinned cells never carry a winning border: in a fixture whose second row draws 2px solid rgb(220, 38, 38), the revealed table's pinned ::before computes 1px solid rgba(0, 0, 0, 0.08) and covers half of the red line (component:Table FR14).
Reading once when PinnedDividerModeWatch mounts, or in the first observer callback when no refresh has run since the attach, would cover it; a browser case that reveals the table from state below the hooks' owner would guard it.
…ts pinned dividers CodeBunny on #8654: with the pinned-divider read moved off the attach, a table mounted from state below the component that calls the hooks (an uncontrolled tab, disclosure or dialog) attached in a commit with no after-commit refresh, and the observer's first callback skipped the read, so a winning row border never reached the pinned cells. The first observer callback now reads the dividers when no read has run since the attach. New story PinnedDividersRevealed and a browser test that reveals the table from state below the owner; 14 browser checks pass in real Chromium.
There was a problem hiding this comment.
Changes requested: pinned columns now keep their row dividers through horizontal scrolling and carry theme and app borders, and a table revealed from state below the component that calls useTableStickyColumns now carries them too. One case still shows the wrong line: when a winning row border is restyled without a commit of that component (state in a component between it and the table, or an app's own dark-mode class), the pinned column keeps the old colour until the pointer crosses the row, while the base showed the new one. A row's border spans the whole row, so letting the table paint it under the pinned cell (drawing nothing there for a row-level winner) follows such restyles in CSS; please do that, keep the value copy only where a cell border wins, and add a browser test that recolours a row border without re-rendering the hooks' owner.
[Automated review]
| } | ||
| continue; | ||
| } | ||
| const value = [`${edge.width}px`, edge.style, edge.color]; |
There was a problem hiding this comment.
This copies a winning row border as values, refreshed only after commits of the component that calls the hook, resizes, pointer and focus changes in the table, and colour-mode changes. When a component between that owner and the table recolours row 2's 2 px border from red to green, the pinned ::before keeps 2px solid rgb(220, 38, 38) while the row is green; the base showed green across, because the table paints a row's border along the whole row. For a row-level winner, drawing nothing on the pinned cell (a carried width of 0px) lets the table paint it and follows the restyle in CSS, pixel-identical to the base; a value copy is only needed where a cell border wins.
…ch the table paints along the row CodeBunny on #8654: a winning row border was copied onto the pinned cell as values, so a restyle with no commit of the hooks' owner (state between it and the table, an app's own dark-mode class) left the old colour under the pinned column until the pointer crossed the row. The table paints a row's (or a row group's) border along the whole row, under the pinned cell too, and follows such a restyle in CSS: for a row-level winner the pinned cell now draws nothing. Only a winning cell border is copied. collapsedBottom reports isRow. The revealed story gains 'Recolour row' (state below the owner); a browser test checks the recoloured border stays whole under the pinned column. 15 browser checks pass in real Chromium.
There was a problem hiding this comment.
Changes requested: pinned columns now keep their row dividers through horizontal scrolling, a winning row border is left to the table so it follows restyles, and open detail panels carry their row's divider. Two things need fixing before this can merge:
- When a cell's own bottom border wins at a width other than the theme's (an app's 2 px
tdborder, say), the pinned cell copies its colour, so a restyle that does not re-render the component callinguseTableStickyColumnsleaves the old colour under the pinned column; carry only the width there, let colour and style keep inheriting, and add a browser test that recolours such a border without that re-render. - Each open detail panel calls
useTheme()and so adds its own colour-scheme listener; read the mode once per table, as the pinned-column watch already does.
[Automated review]
| const value = edge.isRow | ||
| ? ['0px', 'none', 'transparent'] | ||
| : [`${edge.width}px`, edge.style, edge.color]; |
There was a problem hiding this comment.
When the cell's own border wins at a width other than --_table-row-divider-width (an app's 2 px td border, say), this also copies its colour and style, so a restyle that commits nothing in the component calling the hook (an ancestor class, state between it and the table) leaves the old colour under the pinned column. With row 2's cells at 2px solid rgb(220, 38, 38) in PinnedDividersRevealed and recoloured green through “Recolour row”, the pinned ::before stays red while the row computes green. Carrying only the width in that case, with style and colour still inherit, follows the restyle in CSS; the next row's winning cell top still needs the value copy.
| const cellRef = useRef<HTMLTableCellElement>(null); | ||
| // Re-rendered when the colour mode changes (a Theme's mode, or the | ||
| // operating system's under `system`), so the carried colour is read again. | ||
| useTheme(); |
There was a problem hiding this comment.
useTheme() here adds one (prefers-color-scheme: dark) listener and one token-map resolution per open panel (10 open panels: 10 listeners, none on the base), which architecture:react-component-runtime INV7 rules out for a repeated row path. A single table-level watch, like PinnedDividerModeWatch in the sticky-columns plugin, can re-read the open panels instead.
…share one colour-mode watch CodeBunny on #8654: - When a cell's own bottom border wins at another width than its divider (an app's 2 px td border), the pinned cell copied its colour and style, so a restyle with no commit of the hooks' owner left the old colour under the pinned column. It now carries the width alone; style and colour keep inheriting from the cell and follow the restyle in CSS. The next row's winning cell top is still carried as values. Story: 'Border on cells'; browser test recolours such a border from state below the owner. - Each open detail panel called useTheme(), one colour-scheme listener per panel. A single PanelDividerModeWatch per table (transformTableContext) re-reads the open panels on a mode change. Test: the listener count is the same with one panel or three open (fails on the previous head). 16 browser checks pass in real Chromium.
There was a problem hiding this comment.
Changes requested: pinned columns now keep their row dividers through horizontal scrolling and both earlier fixes are in, but the detail-panel divider and CI need work before this can merge.
- The panel copies even the default border token into an inline literal, so after a theme switch that doesn't re-render the table the open panel keeps the old theme's divider; carry only real overrides and re-read them on theme changes.
PanelDividerModeWatchadds a hidden<span>to find its table by sibling order, which also misses the table whenuseTablePaginationfollows the expansion plugin under another key; a ref the hook owns, as the pinned-column watch uses, needs no element.- CI
lintfails on theas typeof window.matchMediacast inuseTableRowExpansion.test.tsx. - The new browser case for a recoloured cell border never reaches the width-only carry; clicking "Border on cells" before "Show table" makes it fail without the fix.
[Automated review]
| }; | ||
| set('--_table-panel-divider-width', edge.width); | ||
| set('--_table-panel-divider-style', edge.style); | ||
| set('--_table-panel-divider-color', edge.color); |
There was a problem hiding this comment.
This writes the row cell's computed colour even when nothing overrides it (rgba(0, 0, 0, 0.08) under the default theme), so the panel stops following the token in CSS: after a theme switch at the same mode that doesn't re-render the table, every row takes the new theme's divider and the open panel keeps the old one (component:Table FR14). Writing these only where the row's cells differ from what the panel resolves without them, and removing them otherwise, keeps the default in CSS.
| carryPanelDivider(cell); | ||
| } | ||
| }, [mode]); | ||
| return <span ref={markerRef} hidden />; |
There was a problem hiding this comment.
This element exists only to find the table by sibling order, and architecture:component-style-authoring INV7 asks any added element to be justified with element counts. With useTablePagination listed after the expansion plugin under a key other than pagination, previousElementSibling is the pagination wrapper, so a mode switch never re-reads the open panels. Keeping the open panel cells in a ref the hook owns, as PinnedDividerModeWatch does with refreshRef, needs no element.
| }, | ||
| removeListener: () => {}, | ||
| } as MediaQueryList; | ||
| }) as typeof window.matchMedia; |
There was a problem hiding this comment.
CI's strict lint fails on this cast: @typescript-eslint/no-unnecessary-type-assertion, reported at line 323. Dropping as typeof window.matchMedia fixes it.
| ); | ||
| await page.getByRole('button', {name: 'Show table'}).click(); | ||
| await expect(page.locator('.astryx-table-scroll-wrapper')).toBeVisible(); | ||
| await page.getByRole('button', {name: 'Border on cells'}).click(); |
There was a problem hiding this comment.
By this click the pinned cell has already read the row's border and sits in the carry state with 0px none transparent; nothing re-reads afterwards, so the line sampled below is the table's own painting and the case passes without the width-only carry. Clicking "Border on cells" before "Show table" and asserting data-astryx-table-pinned="width" makes it fail without the fix.
… the cells in a ref CodeBunny on #8654: - The panel copied even the default border token into inline values, so after a theme switch that did not re-render the table the open panel kept the old theme's divider. It now carries the row's divider only where it differs from what the panel paints with nothing carried, and removes it otherwise, so the tokens stay in CSS. The watch re-reads the open panels on a mode or a theme change. - PanelDividerModeWatch found its table through a hidden element by sibling order (missing it behind a pagination wrapper). The open panels now register their cells in a set the hook owns; no element is added. - The listener-count test drops its cast (strict lint). - The cell-border browser case puts the border on the cells before the table first reads it and asserts the width-only carry, so it fails without that fix; the panel case asserts nothing is carried by default. 16 browser checks pass in real Chromium.
There was a problem hiding this comment.
Changes requested: pinned columns now keep their row dividers through horizontal scrolling, the open panel carries its row's overrides, and all four earlier points are fixed, but the colour-mode watches need tests that fail without them.
- The two "a carried border follows …" browser cases use "Token row borders", a row border the table now paints itself, so they still pass with
PinnedDividerModeWatch's re-read removed; running them on a next row's wider top border invar(--color-border)makes them exercise the carried value. - No case exercises
PanelDividerModeWatch's re-read; a panel case with a token-coloured override on the row's cells across a mode switch would.
[Automated review]
| } | ||
| }); | ||
|
|
||
| test('a carried border follows an operating-system switch between light and dark', async ({ |
There was a problem hiding this comment.
This case no longer reaches a carried value: "Token row borders" gives the rows a 2 px border that wins the collapse, so the pinned cell draws nothing (0px none) in both modes and both sampled columns are the table's own painting. Replayed with PinnedDividerModeWatch's re-read removed, it still passes. The one colour a pinned cell still carries as values is a next row's wider top border: with that border in var(--color-border) (for example "Thick top"), the same switch leaves the pinned line at 24 on the 27 base without the watch, against the row's 60.
| .toBe(true); | ||
| }); | ||
|
|
||
| test("a carried border follows a Theme switched between the hooks' owner and the table", async ({ |
There was a problem hiding this comment.
Same as the operating-system case: with "Token row borders" nothing is carried, so this passes with the watch's re-read removed; a next row's token-coloured top border makes it exercise the watch.
| } | ||
| }); | ||
|
|
||
| test("an open panel's divider follows an operating-system switch between light and dark", async ({ |
There was a problem hiding this comment.
This covers the default, where nothing is carried and CSS follows the switch. PanelDividerModeWatch's re-read has no case: with the row's cells at var(--color-text-secondary) dashed, the panel carries rgb(71, 71, 71) and, with the re-read removed, keeps it after a dark switch while the row's cells read rgb(158, 158, 158).
…hout them CodeBunny on #8654: the carried-border mode cases used a row border, which the table now paints itself, so they passed with the pinned watch's re-read removed, and no case reached the panel watch's re-read. - PinnedDividersLive's 'Token row borders' becomes 'Token top border': the third row's 3 px top border in the border token, which the pinned cells above it carry as values. The Theme-between case fails with the pinned watch's re-read removed (the operating-system case is re-read by the scheme change's resize as well). - PanelDividerFollowsScheme takes 'override': the row's cells dashed in a token colour, which the panel carries; a new case switches the operating system's mode and fails with the panel watch's re-read removed. 17 browser checks pass in real Chromium.
There was a problem hiding this comment.
Changes requested: pinned columns now keep their row dividers through horizontal scrolling, and the Theme-switch and panel mode cases now fail without their watches, but two small points remain.
PinnedDividerModeWatchre-reads only on a colour-mode change, so after a theme switch at the same mode (neutral to stone, say) through a Theme the hooks' owner doesn't re-render for, a carried pinned divider keeps the old theme's colour while the row takes the new one; keying it onuseThemeName()asPanelDividerModeWatchdoes, with a browser case, would fix it.- "a carried border follows an operating-system switch between light and dark" still passes with that watch's re-read removed, because the resize read after "Token top border" lands after the scheme switch; waiting a couple of frames before
emulateMediamakes it depend on the watch.
[Automated review]
| }: { | ||
| refreshRef: RefObject<(() => void) | null>; | ||
| }) { | ||
| const {mode} = useTheme(); |
There was a problem hiding this comment.
This watches the colour mode only. A carried value is a resolved colour, so a theme switch at the same mode, through a Theme between the hooks' owner and the table, re-reads nothing: with the third row's cells at border-top: 3px solid var(--color-border) and neutral switched to stone in light mode, the pinned ::before keeps rgba(0, 0, 0, 0.08) (235) while the row draws rgb(226, 226, 232), where the base follows the switch (component:Table FR14). PanelDividerModeWatch already keys on useThemeName() too; doing the same here, with a browser case that switches theme at the same mode, would cover it.
| await page.getByRole('button', {name: 'Token top border'}).click(); | ||
| await page.emulateMedia({colorScheme: 'dark'}); |
There was a problem hiding this comment.
"Token top border" grows the third row, so the table's resize observer re-reads the pinned dividers a frame after this click, which lands after the scheme switch. Replayed in Chromium, this case passes with PinnedDividerModeWatch's re-read removed; with a 500 ms pause before the switch the same mutant fails (pinned 24 against the row's 60). Waiting a couple of frames here, as scrollTo does, makes the case depend on the watch (architecture:component-test-sufficiency INV6).
…he same mode too CodeBunny on #8654: - PinnedDividerModeWatch re-read only on a colour-mode change, so a theme switched at the same mode (neutral to stone) through a Theme the hooks' owner does not re-render for left a carried pinned divider in the old theme's colour. It keys on the theme name too, as the panel watch does. Story: 'Theme stone' beside 'Theme dark'; a browser case switches theme at the same mode. (Stone's own metrics also resize the table, so its resize read reaches the dividers as well.) - The operating-system case waits for the resize read that follows the border before switching, so it fails with the watch's re-read removed. 18 browser checks pass in real Chromium.
There was a problem hiding this comment.
Changes requested: pinned columns now keep their row dividers while the table scrolls and open detail panels carry their row's divider, matching component:Table FR14, and the WebKit and dark-mode tone differences stand as the engineering owner decided. One browser case still needs to prove what it covers: "a carried border follows a theme switched at the same mode between the hooks' owner and the table" passes with PinnedDividerModeWatch's re-read removed, because the stale line (235) sits inside its 12-level tolerance of the row's stone border (226), so comparing with the default tolerance, or checking the pinned ::before's computed colour, would make it fail without the fix.
[Automated review]
| await expect | ||
| .poll(async () => { | ||
| const {pinned, unpinned} = await dividerPixels(page, 1); | ||
| return sameColumn(pinned, unpinned, 12); |
There was a problem hiding this comment.
This passes with PinnedDividerModeWatch's re-read removed: the pinned line keeps the neutral token (235) while the row draws stone's border (226), 9 levels apart, inside this tolerance of 12. sameColumn(pinned, unpinned) with the default 6 passes on the head, where both read 226, and fails without the re-read (architecture:component-test-sufficiency INV6).
…omputed colour CodeBunny on #8654: the two themes' border tokens sit a few levels apart in pixels (235 against 226), inside the pixel tolerance, so the case passed with the watch's re-read removed. It now compares the pinned ::before's computed colour with the border it carries, and fails without the re-read. 18 browser checks pass in real Chromium.
|
/approve-spec 5ad737b |
There was a problem hiding this comment.
Incremental review of b3c442a..5ad737b; prior findings carried: user_impact, evidence_by_spec_claim
Recommended for approval: pinned columns now keep their row dividers while the table scrolls and open detail panels carry their row's divider, matching component:Table FR14, with the WebKit and dark-mode tone differences standing as the engineering owner decided. The same-mode theme-switch browser case now compares computed colours and fails without PinnedDividerModeWatch's re-read, which closes the last open point. One optional cleanup: that case no longer compares pixels, so its WebKit double-paint skip (line 404) can go, since it passes in WebKit without it.
[Automated review]
| page, | ||
| browserName, | ||
| }) => { | ||
| test.skip(browserName === 'webkit', WEBKIT_DOUBLE_PAINT); |
There was a problem hiding this comment.
Optional: this case now compares computed colours, not pixels, so WebKit's double paint no longer affects it. With this skip removed it passes in WebKit on this revision and fails there when PinnedDividerModeWatch's re-read is removed, so dropping the skip keeps WebKit coverage of the theme-name re-read.
# Conflicts: # packages/core/src/Table/plugins/rowExpansion/useTableRowExpansion.tsx # packages/core/src/Table/plugins/stickyColumns/useTableStickyColumns.tsx
What changes for people using Table
A table with a pinned column (
useTableStickyColumns) could lose a row's divider under the pinned column while it scrolled horizontally. With collapsed borders the table paints every border at its cell's static place: a sticky cell moves and its border does not, so the line under a pinned column was whichever scrolled cell's border passed beneath it, and went missing where that cell drew none (an expanded detail row, a cell styled without a border).Now each pinned cell draws its own divider, which moves with it.
::before(already the row overlay's layer) reaches the bottom of the cell's border area, covers what the table painted there with the pinned base, and draws the divider.:hoverincluded, reaches it with no script. Where another border wins the collapse instead (an app's border on the row, or the next row's wider top border), it is read after each commit and on resize and carried; the carry is dropped once the cell's own border wins again. The pinned dividers are also read again when the operating system switches between light and dark (a theme insystemmode). The edge shadows also refresh after each commit and when the table itself resizes (columns added).In the light themes static rendering is pixel-identical to before, at rest and scrolled 150 px (pin-start and pin-both-edges stories, desktop and 390 px), with row shift 0 px. In a dark theme the divider under the pinned column sits over the pinned column's own base (
--table-sticky-background, the card surface), as the column's content does, so where that base differs from the table's background the line reads a shade different from the rest of the row.Known WebKit difference. WebKit paints a translucent collapsed border twice, so the default divider (
rgba(0,0,0,.08)) shows darker across a row (216 on white) than its colour; a pinned cell draws the token once, at its true colour (235). The three pixel comparisons against the token-coloured row skip WebKit with that reason; the component has no browser detection.Evidence (real Chromium)
Desktop and 390 px captures: before (missing divider under the pinned column), after (drawn), and the new "Pinned dividers" story with a themed border color and an app's 2 px row border carried onto the pinned cells. Attached below.
Tests
TableStickyDividers.a11y.browser.spec.ts(Chromium and WebKit): the pinned divider matches its row at rest and scrolled; it survives a scrolled cell with no border; a theme's color and an app's row border carry over.pnpm -F @astryxdesign/core typecheck; Table suite 637 pass.Desktop
390 px