[ButtonGroup] Fix variant outlined always has primary color borders on hover #29487
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #29219
The border-color style is applied in the
Button
component and we don't need to have it inButtonGroup
. 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
theborder-right-color
andborder-bottom-color
forhorizontal
andvertical
orientation respectively istransparent
, 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
andButton
but theButton
ones had high specificity. In v5, with the new styling solution, thegrouped
selector withinroot
($ .grouped
) inButtonGroup
got the high specificity. But anyway I think we need not have border color styles inButtonGroup
.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