-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[DataGrid] Fix separator styles on touch devices #14471
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -299,12 +299,13 @@ export const GridRootStyles = styled('div', { | |
`]: { | ||
[`& .${c.columnSeparator}`]: { | ||
opacity: 0, | ||
'@media (hover: none)': { | ||
}, | ||
// Show resizable separators at all times on touch devices | ||
'@media (hover: none)': { | ||
[`& .${c['columnSeparator--resizable']}`]: { | ||
opacity: 1, | ||
color: (t.vars || t).palette.primary.main, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was problematic - the conditions of the separator being the primary color are different on touch devices to desktop. Moved here: https://github.com/mui/mui-x/pull/14471/files#diff-e1db53193a627d36d1cd3f651a954ee1e32ecb93caa020446631d722bb1be75cR415-R422 |
||
}, | ||
}, | ||
// Show resizable separators again when the column is hovered | ||
[`& .${c['columnSeparator--resizable']}:hover`]: { | ||
opacity: 1, | ||
}, | ||
|
@@ -411,6 +412,14 @@ export const GridRootStyles = styled('div', { | |
}, | ||
'@media (hover: none)': { | ||
[`& .${c.columnHeader}`]: columnHeaderStyles, | ||
[`& .${c.columnHeader}:focus, | ||
& .${c.columnHeader}:focus-within, | ||
& .${c.columnHeader}:has(+ .${c.columnHeader}:focus), | ||
& .${c.columnHeader}:has(+ .${c.columnHeader}:focus-within)`]: { | ||
[`.${c['columnSeparator--resizable']}`]: { | ||
color: (t.vars || t).palette.primary.main, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the motivation behind having separators in an "active" state when the column header cell is selected? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, this makes sense then 👍🏻 |
||
}, | ||
}, | ||
}, | ||
[`& .${c['columnSeparator--sideLeft']}`]: { | ||
left: columnSeparatorOffset, | ||
|
@@ -427,16 +436,17 @@ export const GridRootStyles = styled('div', { | |
[`& .${c['columnSeparator--resizable']}`]: { | ||
cursor: 'col-resize', | ||
touchAction: 'none', | ||
[`&.${c['columnSeparator--resizing']}`]: { | ||
color: (t.vars || t).palette.primary.main, | ||
}, | ||
// Always appear as draggable on touch devices | ||
'@media (hover: none)': { | ||
[`& .${c.iconSeparator} rect`]: separatorIconDragStyles, | ||
color: borderColor, | ||
}, | ||
[`&:hover, &.${c['columnSeparator--resizing']}`]: { | ||
color: (t.vars || t).palette.primary.main, | ||
[`& .${c.iconSeparator} rect`]: separatorIconDragStyles, | ||
'@media (hover: none)': { | ||
color: borderColor, | ||
'@media (hover: hover)': { | ||
'&:hover': { | ||
color: (t.vars || t).palette.primary.main, | ||
[`& .${c.iconSeparator} rect`]: separatorIconDragStyles, | ||
}, | ||
}, | ||
'& svg': { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be in favor of removing these lines: https://github.com/mui/mui-x/pull/14471/files#diff-e1db53193a627d36d1cd3f651a954ee1e32ecb93caa020446631d722bb1be75cR447-R449
So that the separator is in an "active" state when you drag it on the touch screen.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good shout, updated here: 1b18a02