-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[AvatarGroup] Fix spacing
prop ignoring value 0
#45799
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
[AvatarGroup] Fix spacing
prop ignoring value 0
#45799
Conversation
Netlify deploy previewhttps://deploy-preview-45799--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
60648c3
to
feaffba
Compare
feaffba
to
84685fe
Compare
spacing
prop should accept value 0
spacing
prop should accept value 0
spacing
prop not accepting value 0
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.
Left 2 comments — thanks for the contribution! Could you add a test case for when spacing
is 0
? It should result in marginLeft: 0px
.
spacing
prop not accepting value 0
spacing
prop ignoring value 0
01ae186
to
84a8888
Compare
84a8888
to
bb9b936
Compare
- Update AvatarGroup spacing prop logic to handle 0 as a valid value. - Ensures that 0 behaves as expected without causing layout issues.
- Restore original import order as per project conventions
bb9b936
to
00280f8
Compare
Thanks @ZeeshanTamboli for reviewing! I’ve added the test case and implemented the changes you suggested. Let me know if anything else is needed. |
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.
Thanks for your contribution!
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.
@Kartik-Murthy Nice work, thanks!
Cherry-pick PRs will be created targeting branches: v6.x |
Co-authored-by: ZeeshanTamboli <[email protected]>
PR Description:
This PR fixes #45797 where the
AvatarGroup
component in MUI v7 ignoresspacing={0}
and defaults to the standard spacing. This occurred because0
was incorrectly treated asfalse
.Changes:
Updated the
AvatarGroup
component to handlespacing={0}
correctly.Ensured that
0
is not treated asfalse
, allowing no spacing between avatars.Passing
Infinity
,-Infinity
,NaN
,-NaN
,1/NaN
andundefined
will default to medium spacing:-8px
This fix restores expected behavior for
spacing={0}
in the MUI v7.Additional
Before: https://codesandbox.io/p/devbox/agitated-johnson-5yx8t9
After fix: https://codesandbox.io/p/sandbox/material-ui-cra-ts-forked-8fmqpp