Repository navigation
feat(Table): add skeleton loading variant - #1229
Conversation
🦋 Changeset detectedLatest commit: 52ddc6e The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Pushed 6f0c360: the placeholders are now real The first version was wrong about table structure — the bars did not line up with the columns they stand in for, and the DOM claimed one cell where the loaded table will have many. That means the earlier note about The visually hidden "Loading data" text went away with the spanned cell; Full suite green again locally: typecheck, lint (0 errors, suppressions file untouched), format, circular-dependency check, 654 unit tests, build, storybook:build. |
|
Reassigning design review to @lifesized since his team uses this component way more than I do. |
`loading` draws a centered spinner, which gives no sense of the shape of the data that is coming. `loadingVariant="skeleton"` draws placeholder rows instead, with `skeletonRowCount` to choose how many. The default is unchanged, so existing consumers see the spinner they have today. The placeholder bars are decorative and the cell keeps the same "Loading data" text the spinner variant announces, visually hidden, so the state is still read out. The table sets `aria-busy` while loading in either variant.
The first version drew the placeholders inside the single spanned cell the spinner uses, which is not a table row: the bars did not line up with the columns and the DOM said one cell where the data will have many. Each placeholder is now a <td> per column. jsx-a11y counts <tr> and <td> as interactive, so aria-hidden on a decorative row trips no-aria-hidden-on-focusable. Neither is focusable without a tabindex, so the two disables carry that reason rather than reshaping the markup around a false positive.
The header count plus the selection and actions columns was spelled out twice, once for the skeleton rows and once for the spanned loading and no-data row.
Export TableLoadingVariant from the package root, size skeleton bars by table size, and drop needless cn calls.
Show the skeleton stories at full width with 6 columns of different widths and 10 rows, and add a story with merged skeleton cells. Add visual specs for Skeleton and the new Table stories.
Fix the gradient to the viewport so every skeleton shows a slice of the same wave, moving at the same speed whatever its size. Under reduced motion the gradient is dropped instead of freezing mid-wave.
Text skeletons draw one or more lines, the last of several at 75% width. Rectangles take a height. Width and height accept a space key or any CSS length, and props that do not fit the shape are type errors. The shimmer is now a 1.25s sweep of the fill's opacity with a 0.25s pause.
Remove colSpan from row cells, the merged-cells skeleton story, its test and its snapshots.
CSS animations start when their element mounts, so a skeleton added later swept out of step with the others. Pin each sweep to the document timeline's origin.
Pin the shimmer to the document timeline on animationstart instead of on mount, so animations created later (reduced motion turned off, a hidden parent shown) stay in phase. Leave consumer animations alone, drop the layout effect that warned during server rendering, and stop object properties such as toString passing as space keys.
A prefix check also matched consumer keyframes such as skeleton-shimmer-custom and pinned them. Match the exact name CSS Modules generates.
ab2507c to
5a705a4
Compare
- Rename the rest props to `props`. - `width` and `height` take plain CSS values; drop the space keys until the new token schema lands. - Size text lines from the font: each bar is 1em tall in a 1lh line, using the `Text` font for its size, so skeleton text is as tall as real text. Table cells use `md`, their font at every table size, and lay the skeleton out like their truncated text, so placeholder rows match data rows. - Animate only under `prefers-reduced-motion: no-preference`; the static fill is the default. - Drop pinning the shimmer to the page clock. Skeletons on screen together still share one sweep through the viewport-fixed gradient.
Animating background-position repainted every skeleton on every frame: about 5% of the main thread for a 10-row table, 12.5% for 60 rows. Each bar now shows a viewport-wide fixed layer, clipped to the bar, that slides with transform, so the browser animates it without repainting. Skeletons on screen together still share one sweep, without relying on background-attachment: fixed, which iOS Safari ignores.
Storybook Preview Deployed✅ Preview URL: https://click-k1l09zx31-clickhouse.vercel.app Built from commit: |
Chromatic Storybook
Built from commit: Statuses as of the end of the run. The build link shows the live review state. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 52ddc6e. Configure here.

Description
Feature
Table'sloadingprop shows one centered spinner. It says nothing about the shape of the data, and the rows jump in when they arrive. There is also no shared skeleton component, so every place that wants one builds its own.Solution
Skeletoncomponent, in two shapes:widthandheighttake a space key or any CSS length. Props that don't fit the shape are type errors.TablegetsloadingVariant="skeleton"andskeletonRowCount. Placeholder rows are real cells with a<Skeleton>in each, so they line up with the columns and follow the table'ssizeandrowHeight. The default is stillspinner.aria-busywhile loading, in both variants.Details
background-attachment: fixed; there each skeleton still shimmers, just not in sync.textandrectangle, noisLoading/children.sizeissm/mduntil the t-shirt scale is decided.aria-hidden. jsx-a11y counts<tr>/<td>as interactive, so two inline disables say why that's fine.Review focus
handleAnimationStartinSkeleton.tsx: it changesstartTimeon CSS animations. It should touch only the shimmer, never a consumer's animation.<tbody>conditions inTable.tsx: the spinner and no-data rows must behave exactly as before.SkeletonProps: is this shape-specific API what we want, before it's public?Links and tickets
CUI-311, and part of CUI-295.
Good to know
New visual specs for
Skeletonand the TableLoadingSkeletonstory, with snapshots generated in Docker. No existing snapshot changed.Checklist
Tableonly changes when you opt inContribution
buildandbuild-storybookwork locallyAccessibility
aria-hidden; the table isaria-busywhile loadingprefers-reduced-motionChecked: 4.1.2 Name, Role, Value and 2.3.3 Animation from Interactions. Not checked: the Storybook axe panel and a real screen reader.
Screenshots
See the Storybook preview:
Display/Skeleton, andDisplay/Table→Loading Skeleton.