feat(core): compact table size, radio single-selection, and fix the dead size prop - #31953
feat(core): compact table size, radio single-selection, and fix the dead size prop#31953harsh-vador wants to merge 1 commit into
Conversation
…size prop
The AntD tables being migrated onto TableV2 are dense — entity pages show 20+
rows at a time, and the existing `sm`/`md` heights push a third of them below
the fold. Adds a `compact` size (h-10 rows, h-8 header, px-4/py-2 cells) for
them to map onto.
`selectionMode="single"` rendered a checkbox, which reads as "pick several".
It now renders RadioButtonBase through React Aria's selection slot, so the
behaviour stays React Aria's and only the visual changes.
Also fixes the `size` prop, which never had any effect: TableContext defaulted
to a filled-in `{ size: 'md' }`, so `context?.size ?? size` always resolved to
the context and discarded the prop. Every table has been rendering at `md`
regardless of what it asked for. The context now defaults to null, so an
explicit prop wins and an enclosing TableCard is still inherited.
Adds table.test.tsx covering all three sizes, the size default, and single vs
multiple selection.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
❌ PR checklist incompleteThis PR cannot be merged until the following are addressed on its linked issue:
The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically. Maintainers can bypass this check by adding the |
|
Hi there 👋 Thanks for your contribution! The OpenMetadata team will review the PR shortly! Once it has been labeled as Let us know if you need any help! |
| /** | ||
| * `compact` matches the density of the AntD tables this component replaces — | ||
| * entity pages show 20+ rows at a time and the `sm`/`md` heights push a third of | ||
| * them below the fold. See docs/antd-migration/table.md. |
There was a problem hiding this comment.
💡 Quality: Comment references non-existent docs/antd-migration/table.md
The new doc comment points readers to docs/antd-migration/table.md, but that file does not exist (the directory only contains README.md, typography.md and button.md). The dangling reference will confuse anyone following it. Either add the table.md doc or drop/redirect the reference.
Was this helpful? React with 👍 / 👎
| {selectionMode === 'single' ? ( | ||
| // A single-selection table reads as a radio group: picking a row | ||
| // clears the previous pick. React Aria still wires the control | ||
| // through the `selection` slot, so the visual is swapped rather | ||
| // than the behaviour. | ||
| <AriaCheckbox | ||
| className="tw:flex tw:items-center tw:outline-hidden" | ||
| slot="selection"> | ||
| {({ isSelected, isDisabled, isFocusVisible }) => ( | ||
| <RadioButtonBase | ||
| isDisabled={isDisabled} | ||
| isFocusVisible={isFocusVisible} | ||
| isSelected={isSelected} | ||
| size={size === 'md' ? 'md' : 'sm'} | ||
| /> |
There was a problem hiding this comment.
💡 Edge Case: Single-selection row renders radio visual but checkbox a11y role
For selectionMode="single" the control is still an AriaCheckbox (slot="selection"), so it exposes role="checkbox" to assistive tech (the test even asserts getByRole('checkbox')). Screen-reader users hear "checkbox" while sighted users see a radio, a semantic mismatch versus the intended "pick one" affordance. If this is an accepted React Aria limitation, note it in the code comment; otherwise consider a radiogroup-based selection so the announced role matches the visual.
Was this helpful? React with 👍 / 👎
Code Review 👍 Approved with suggestions 0 resolved / 2 findingsAdds compact table sizing, radio single-selection mode, and fixes the dead size context propagation. Update the documentation reference path and align the single-selection accessibility role with its radio visuals. 💡 Quality: Comment references non-existent docs/antd-migration/table.md📄 openmetadata-ui-core-components/src/main/resources/ui/src/components/application/table/table.tsx:72 The new doc comment points readers to 💡 Edge Case: Single-selection row renders radio visual but checkbox a11y roleFor 🤖 Prompt for agentsOptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
✅ Playwright Results — workflow succeededValidated commit ✅ 65 passed · ❌ 0 failed · 🟡 0 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 39m 3s ⏱️ Max setup 2m 46s · max shard execution 6m 39s · max shard-job elapsed before upload 9m 45s · reporting 3s 🌐 156.97 requests/attempt · 1.73 app boots/UI scenario · 0.00% common-shard skew Optimization targets still in progress:
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
| <AriaCheckbox | ||
| className="tw:flex tw:items-center tw:outline-hidden" | ||
| slot="selection"> | ||
| {({ isSelected, isDisabled, isFocusVisible }) => ( | ||
| <RadioButtonBase | ||
| isDisabled={isDisabled} | ||
| isFocusVisible={isFocusVisible} | ||
| isSelected={isSelected} | ||
| size={size === 'md' ? 'md' : 'sm'} | ||
| /> | ||
| )} | ||
| </AriaCheckbox> |
There was a problem hiding this comment.
| @@ -0,0 +1,87 @@ | |||
| import { render, screen, within } from '@testing-library/react'; | |||
There was a problem hiding this comment.
This new TSX file omits the repository-required Apache-2.0 license header, leaving it inconsistent with the source-licensing convention and subject to license-header validation failure.
Context Used: openmetadata-ui-core-components/CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
❌ UI Checkstyle Failed❌ Core Components - ESLint + PrettierOne or more core-component files have linting or formatting issues. Affected files
Fix locally (fast - only checks files changed in this branch): make ui-checkstyle-changed |
Groundwork for migrating the AntD tables onto
TableV2.size="compact"The tables being migrated are dense — entity pages show 20+ rows at a time, and the existing
sm/mdheights push a third of them below the fold. Adds a third size (h-10rows,h-8header,px-4 py-2cells) for them to map onto.Radio for single selection
selectionMode="single"rendered a checkbox, which reads as "pick several". It now rendersRadioButtonBasethrough React Aria's selection slot, so the behaviour stays React Aria's and only the visual changes.The
sizeprop never workedTableContextdefaulted to a filled-in{ size: 'md' }, socontext?.sizealways won and the prop was discarded — every table has been rendering atmdregardless of what it asked for. The context now defaults tonull, so an explicit prop wins and an enclosingTableCardis still inherited.This surfaced from writing the unit test, not from review — worth knowing if any table looked denser in a design than it did in the app.
Verification
table.test.tsxadded: all three sizes, the size default, single vs multiple selectionyarn vitest run— 25/25tsc --noEmitclean,eslintcleanNote for reviewers
openmetadata-uitypechecks against this package's prebuiltdist/, not its source. Anything consumingcompactneeds a core build first, or it will fail to typecheck for a reason that has nothing to do with it.🤖 Generated with Claude Code
Greptile Summary
The PR adds a compact table density, fixes explicit and inherited size resolution, and gives single-selection controls a radio-style appearance.
Confidence Score: 4/5
The accessibility-semantic mismatch in single-selection tables should be fixed before merging; the missing test-file license header is also actionable.
Single-selection controls are now visually rendered as radio buttons but remain semantic checkboxes, causing assistive technology and keyboard interaction to disagree with the presented control.
Files Needing Attention: openmetadata-ui-core-components/src/main/resources/ui/src/components/application/table/table.tsx; openmetadata-ui-core-components/src/main/resources/ui/src/components/application/table/table.test.tsx
Important Files Changed
Reviews (1): Last reviewed commit: "feat(core): add compact table size, radi..." | Re-trigger Greptile
Context used: