MudTable: Fix loading bar offset when the header row is missing or empty

Merged
DA
3mo ago
+7-0

Fixes #12182

.mud-table-sticky-header .mud-table-head .mud-table-loading pins the built-in progress row with a hard-coded top: $header-height-dense, independent of the header row's actual rendered height. With CustomHeader="true" and an empty HeaderContent the header has no height, so the loading bar is pushed 39px down into empty space instead of sitting flush against the top of the table.

This adds a top: 0 for the two shapes where there is no header row to sit under: the loading row is the first row, or the row above it renders no cells.

.mud-table-loading-row:first-child > .mud-table-loading,
tr:not(:has(> *)) + .mud-table-loading-row > .mud-table-loading {
  top: 0;
}

Measured in Chrome as the loading bar's top minus the scroll container's top, at rest and at scrollTop = 120:

tableshapebeforeafter
AFixedHeader, CustomHeader, empty HeaderContent (the issue)39px0px
Bsame but FixedHeader="false" (the thread's workaround)0px0px
DFixedHeader with a real <MudTh> header (regression control)39px39px

D stays pinned at 39px both at rest and while scrolling, so normal sticky-header behaviour is unchanged.

Before/After

Before

image

After

image