Conversation
| transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], { | ||
| duration: theme.transitions.duration.short, | ||
| }), |
There was a problem hiding this comment.
add transition (exclude color) due to this glitch.
loading-button-transition.mp4
| ...(styleProps.loadingPosition === 'center' && { | ||
| [`&.${buttonClasses.disabled}`]: { | ||
| color: 'transparent', | ||
| }, | ||
| }), | ||
| })); |
| ...(styleProps.loadingPosition === 'center' && { | ||
| left: '50%', | ||
| transform: 'translate(-50%)', | ||
| color: theme.palette.action.disabled, |
There was a problem hiding this comment.
because of the above fix. color: transparent makes indicator disappear, so need to force the color same is disabled state in Button
de5b0b9 to
48096de
Compare
mnajdova
left a comment
There was a problem hiding this comment.
I could not spot any issues, we should just fix the test before merging
mnajdova
left a comment
There was a problem hiding this comment.
Looks good, I could not test only Safari.
There was a problem hiding this comment.
Regarding the transition when centered, the only solution I could find is adding the span back for the loading label. So it can also support more complex children
I could find one change to improve the transition for the start and end icons that works both on this PR and HEAD:
diff --git a/packages/material-ui-lab/src/LoadingButton/LoadingButton.js b/packages/material-ui-lab/src/LoadingButton/LoadingButton.js
index 03195089be..c4cc467b73 100644
--- a/packages/material-ui-lab/src/LoadingButton/LoadingButton.js
+++ b/packages/material-ui-lab/src/LoadingButton/LoadingButton.js
@@ -56,11 +56,11 @@ const LoadingButtonRoot = styled(Button, {
transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], {
duration: theme.transitions.duration.short,
}),
- [`& .${loadingButtonClasses.startIconLoadingStart}`]: {
- visibility: 'hidden',
- },
- [`& .${loadingButtonClasses.endIconLoadingEnd}`]: {
- visibility: 'hidden',
+ [`& .${loadingButtonClasses.startIconLoadingStart}, & .${loadingButtonClasses.endIconLoadingEnd}`]: {
+ transition: theme.transitions.create(['opacity'], {
+ duration: theme.transitions.duration.short,
+ }),
+ opacity: 0,
},
...(styleProps.loadingPosition === 'center' && {
[`&.${buttonClasses.disabled}`]: {What it does on HEAD:
| transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color'], { | ||
| duration: theme.transitions.duration.short, | ||
| }), |
In my opinion, adding the span back is a no go as we learned from other components that the structure should not surprise people. Screen.Recording.2564-06-10.at.09.49.28.movHere, I think it is better. remove |
|
There are two issues with the current animation: 1. the icons disappear instantly (which is quite visible), 2. the border-radius color isn't in sync with the text color. It doesn't feel as smooth as on #26666 (review). The last one can be fixed if we add a Another issue of not using a span: this do no longer work: <LoadingButton
onClick={handleClick}
loading={loading}
loadingIndicator="Loading..."
variant="outlined"
>
Notifications <Badge>9</Badge>
</LoadingButton>
Agree with this downside. It's definitely a tradeoff. |
There was a problem hiding this comment.
I have added a new commit. Happy to moving forward as is. At least, we are conscious about the <span> tradeoff:
Cons:
- Surprising DOM structure for new users
Pros:
- Support any children. I think that we can expect new GitHub issues for it once this gets released. We will see if there is enough 👍 to force us to reconsider & revert.
- A slightly better transition
- Same DOM structure for previous users
|
@siriwatknp I have updated #20012 to check [ ] and link this PR. If you could do it for the other efforts, it will be 👌. |





BREAKING CHANGES
The
spanelement that wraps children has been removed.labelclassKey is also removed.Preview
https://deploy-preview-26666--material-ui.netlify.app/components/buttons/
Changes Summary
labelclasses and element fromButtonandLoadingButtonLoadingButtonposition: center styling because it rely on label before.History
button > span > childrenexists as a workaround for flex container bug on button BUT not anymore, so this PR remove the span.https://github.com/philipwalton/flexbugs#flexbug-9
Continue #24222