You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix table body to avoid unnecessary scrollbar when all rows fit
Account for header height in body height calculation
Non-compliant requirements:
Verify behavior in examples where the container height is greater than content height (requires broader testing across sizes and variants)
Requires further human verification:
Visual verification across different table sizes, densities, and themes to ensure no regressions (e.g., sticky header, virtualized rows, zebra stripes).
Cross-browser testing (Chrome, Firefox, Safari, Edge) to confirm calc and CSS var behave consistently.
Confirm behavior when no header is rendered or when multi-header rows exist.
The new height calculation assumes a single header row height equals var(--table-row-size). Verify behavior with variable header heights, multiple header rows, or when header size differs from row size.
The table container must have a definite height for calc(100% - var(--table-row-size)) to compute correctly; confirm no cases where 100% is undefined, which could collapse the body.
TableBody.module.scss now always sets height: calc(100% - var(--table-row-size)), so when a
<Table /> is rendered without a <TableHeader /> the body becomes shorter than the table
container by one row height. This can break headerless tables (including loading/empty/error cases)
by leaving unused space and altering expected full-height body rendering.
The Table API and tests show headerless tables are supported, but the new unconditional subtraction
uses --table-row-size even when no header is rendered, reducing body height in those supported
configurations.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
`TableBody` height always subtracts `--table-row-size`, but `<Table>` supports being rendered without `<TableHeader>`, so the body should only subtract the header height when a header is actually present.
## Issue Context
- `--table-row-size` is always provided by `Table`, independent of whether a header is rendered.
- There are existing code paths/tests that render `<Table>` with only `<TableBody>`.
## Fix approach (recommended)
1. Compute `hasHeader` in `Table.tsx` by inspecting `children`.
2. Expose a CSS variable like `--table-header-height` set to either `RowHeights[size]px` when `hasHeader` is true, or `0px` otherwise.
3. Update `TableBody.module.scss` to use `calc(100% - var(--table-header-height))` (or `var(--table-header-height, 0px)` as a fallback).
## Fix Focus Areas
- packages/core/src/components/Table/TableBody/TableBody.module.scss[1-3]
- packages/core/src/components/Table/Table/Table.tsx[83-89]
- packages/core/src/components/Table/Table/Table.tsx[148-156]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
2. Missing EOF newline 🐞 Bug⚙ Maintainability
Description
TableBody.module.scss is missing a trailing newline, which can create noisy diffs and trigger
formatting/lint tooling issues.
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution
## Issue description
The SCSS file does not end with a newline (shown in the diff as `No newline at end of file`).
## Fix Focus Areas
- packages/core/src/components/Table/TableBody/TableBody.module.scss[1-3]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
This PR fixes an issue where the table body always displayed a vertical scrollbar, even when there was no overflow content.
Changed .tableBody height from 100% to calc(100% - var(--table-row-size))
This adjustment ensures the table body height accounts for the header row and only shows the scrollbar when needed
Tested locally in Storybook to confirm that the scrollbar now only appears when the content exceeds the available space
I have read the Contribution Guide for this project.
Resolves #3127
PR Type
Bug fix
Description
Fix unnecessary scrollbar in table body by adjusting height calculation
Changed height from 100% to calc(100% - var(--table-row-size))
Scrollbar now only appears when content overflows available space
Diagram Walkthrough
File Walkthrough
TableBody.module.scss
Adjust table body height calculationpackages/core/src/components/Table/TableBody/TableBody.module.scss
.tableBodyheight from100%tocalc(100% -var(--table-row-size))