Skip to content

Commit 54fb311

Browse files
insanrizkyclaude
andauthored
[data grid] Fix selected row background with cssVariables.nativeColor (#24215)
Co-authored-by: Insan Rizky <8219655+insanrizky@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 976ec02 commit 54fb311

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

‎packages/x-data-grid/src/components/GridRowDragAndDropOverlay.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const GridRowDragAndDropOverlayRoot = styled('div', {
5454

5555
...(action === 'inside' && {
5656
backgroundColor: theme.vars
57-
? `rgba(${theme.vars.palette.primary.mainChannel} / 0.1)`
57+
? `rgba(from ${theme.vars.palette.primary.main} r g b / 0.1)`
5858
: alpha(theme.palette.primary.main, 0.1),
5959
}),
6060
}));

‎packages/x-data-grid/src/material/variables.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,14 @@ function transformTheme(t: Theme): GridCSSVariablesInterface {
2828
const backgroundHeader = dataGridPalette?.headerBg ?? backgroundBase;
2929
const backgroundPinned = dataGridPalette?.pinnedBg ?? backgroundBase;
3030
const backgroundBackdrop = t.vars
31-
? `rgba(${t.vars.palette.background.defaultChannel} / ${t.vars.palette.action.disabledOpacity})`
31+
? setOpacity(t.vars.palette.background.default, t.vars.palette.action.disabledOpacity)
3232
: alpha(t.palette.background.default, t.palette.action.disabledOpacity);
3333
const backgroundOverlay =
3434
t.palette.mode === 'dark'
3535
? colorMixIfSupported(`color-mix(in srgb, ${paperColor} 90%, #fff)`, paperColor)
3636
: paperColor;
3737

38-
const selectedColor = t.vars
39-
? `rgb(${t.vars.palette.primary.mainChannel})`
40-
: t.palette.primary.main;
38+
const selectedColor = (t.vars || t).palette.primary.main;
4139

4240
const radius = getRadius(t);
4341

0 commit comments

Comments
 (0)