Skip to content

[DataGrid] Fix visual issue with pinned columns and row spanning #16923

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type GridBottomContainerProps = React.PropsWithChildren;

const Element = styled('div')({
position: 'sticky',
zIndex: 4,
zIndex: 40,
bottom: 'calc(var(--DataGrid-hasScrollX) * var(--DataGrid-scrollbarSize))',
});

Expand Down
4 changes: 2 additions & 2 deletions packages/x-data-grid/src/components/cell/GridCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -334,10 +334,10 @@ const GridCell = forwardRef<HTMLDivElement, GridCellProps>(function GridCell(pro

if (rowSpan > 1) {
cellStyle.height = `calc(var(--height) * ${rowSpan})`;
cellStyle.zIndex = 5;
cellStyle.zIndex = 10;

if (isLeftPinned || isRightPinned) {
cellStyle.zIndex = 6;
cellStyle.zIndex = 40;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,13 +413,13 @@ export const GridRootStyles = styled('div', {
},
[`& .${c['columnHeader--pinnedLeft']}, & .${c['columnHeader--pinnedRight']}`]: {
position: 'sticky',
zIndex: 4, // Should be above the column separator
zIndex: 40, // Should be above the column separator
background: vars.header.background.base,
},
[`& .${c.columnSeparator}`]: {
position: 'absolute',
overflow: 'hidden',
zIndex: 3,
zIndex: 30,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
Expand Down Expand Up @@ -671,7 +671,7 @@ export const GridRootStyles = styled('div', {
},
[`& .${c['cell--pinnedLeft']}, & .${c['cell--pinnedRight']}`]: {
position: 'sticky',
zIndex: 3,
zIndex: 30,
background: vars.cell.background.pinned,
'&.Mui-selected': {
backgroundColor: pinnedSelectedBackground,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export type GridBottomContainerProps = React.PropsWithChildren;

const Element = styled('div')({
position: 'sticky',
zIndex: 4,
zIndex: 40,
bottom: 'calc(var(--DataGrid-hasScrollX) * var(--DataGrid-scrollbarSize))',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const useUtilityClasses = () => {

const Element = styled('div')({
position: 'sticky',
zIndex: 4,
zIndex: 40,
top: 0,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ const useUtilityClasses = (ownerState: OwnerState, position: Position) => {
const Scrollbar = styled('div')({
position: 'absolute',
display: 'inline-block',
zIndex: 6,
zIndex: 60,
'&:hover': {
zIndex: 7,
zIndex: 70,
},
// In macOS Safari and Gnome Web, scrollbars are overlaid and don't affect the layout. So we consider
// their size to be 0px throughout all the calculations, but the floating scrollbar container does need
Expand Down
Loading