Skip to content

[ButtonGroup] Fix variant outlined always has primary color borders on hover - #29487

Merged
ZeeshanTamboli merged 3 commits into
mui:masterfrom
ZeeshanTamboli:issue-29219-buttongroup-border-on-hover
Nov 4, 2021
Merged

ZeeshanTamboli merged 3 commits into
mui:masterfrom
ZeeshanTamboli:issue-29219-buttongroup-border-on-hover

Conversation

@ZeeshanTamboli

@ZeeshanTamboli ZeeshanTamboli commented Nov 3, 2021 •

Copy link
Copy Markdown
Member

Fixes #29219

The border-color style is applied in the Button component and we don't need to have it in ButtonGroup. Since the hovering behaviour is such that it is not on the complete ButtonGroup but instead on individual buttons within button group.

Since in ButtonGroup the border-right-color and border-bottom-color for horizontal and vertical orientation respectively is transparent, while hovering we take the current color value.

I think this is a regression from v5.0.0-alpha.25 from PR #24775.

In v4, we had border color styles while hovering on both ButtonGroup and Button but the Button ones had high specificity. In v5, with the new styling solution, the grouped selector within root ($ .grouped) in ButtonGroup got the high specificity. But anyway I think we need not have border color styles in ButtonGroup.


Before v5.0.0-alpha.25 : https://codesandbox.io/s/mui-buttongroup-color-bug-forked-xw8ke?file=/src/Demo.tsx (in v5.0.0-alpha.24)

Before fix: https://codesandbox.io/s/mui-buttongroup-color-bug-t37rv?file=/src/Demo.tsx
After fix: https://codesandbox.io/s/mui-buttongroup-color-bug-63351?file=/src/Demo.tsx

@ZeeshanTamboli ZeeshanTamboli changed the title [ButtonGroup] Fix variant outlined border color on hover [ButtonGroup] Fix variant outlined always has primary color borders on hover Nov 3, 2021
@ZeeshanTamboli ZeeshanTamboli added type: bug It doesn't behave as expected. component: ButtonGroup The React component. labels Nov 3, 2021
@mui-pr-bot

mui-pr-bot commented Nov 3, 2021 •

Copy link
Copy Markdown

Details of bundle changes

Generated by 🚫 dangerJS against c01fd13

@ZeeshanTamboli
ZeeshanTamboli marked this pull request as ready for review November 3, 2021 13:41

@mnajdova mnajdova left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👌

@ZeeshanTamboli
ZeeshanTamboli merged commit b845d34 into mui:master Nov 4, 2021
@ZeeshanTamboli
ZeeshanTamboli deleted the issue-29219-buttongroup-border-on-hover branch November 4, 2021 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: ButtonGroup The React component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ButtonGroup variant outlined always has primary color borders on hover

3 participants