Skip to content

Commit

Permalink
[ButtonGroup] Should not retain divider color when it is disabled and…
Browse files Browse the repository at this point in the history
… variant is `text` (#36967)

Co-authored-by: FeCurtain <[email protected]>
Co-authored-by: ZeeshanTamboli <[email protected]>
  • Loading branch information
3 people authored Apr 28, 2023
1 parent 3d618c4 commit a050aab
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/mui-material/src/ButtonGroup/ButtonGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ const ButtonGroupRoot = styled('div', {
: `1px solid ${
theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'
}`,
[`&.${buttonGroupClasses.disabled}`]: {
borderRight: `1px solid ${(theme.vars || theme).palette.action.disabled}`,
},
}),
...(ownerState.variant === 'text' &&
ownerState.orientation === 'vertical' && {
Expand All @@ -122,6 +125,9 @@ const ButtonGroupRoot = styled('div', {
: `1px solid ${
theme.palette.mode === 'light' ? 'rgba(0, 0, 0, 0.23)' : 'rgba(255, 255, 255, 0.23)'
}`,
[`&.${buttonGroupClasses.disabled}`]: {
borderBottom: `1px solid ${(theme.vars || theme).palette.action.disabled}`,
},
}),
...(ownerState.variant === 'text' &&
ownerState.color !== 'inherit' && {
Expand Down
45 changes: 45 additions & 0 deletions test/regressions/fixtures/ButtonGroup/DisabledButtonGroup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import * as React from 'react';
import Button from '@mui/material/Button';
import Box from '@mui/material/Box';
import ButtonGroup from '@mui/material/ButtonGroup';

const buttons = [
<Button key="one">One</Button>,
<Button key="two">Two</Button>,
<Button key="three">Three</Button>,
];

export default function DisabledButtonGroup() {
return (
<Box
sx={{
display: 'flex',
alignItems: 'center',
'& > *': {
m: 1,
},
}}
>
{/* variant="text" */}
<ButtonGroup
color="error"
orientation="horizontal"
aria-label="horizontal text button group"
variant="text"
disabled
>
{buttons}
</ButtonGroup>
{/* variant="text" */}
<ButtonGroup
color="error"
orientation="vertical"
aria-label="vertical text button group"
variant="text"
disabled
>
{buttons}
</ButtonGroup>
</Box>
);
}

0 comments on commit a050aab

Please sign in to comment.