Open wg-xb opened 2 months ago
Hey @wg-xb, thanks for the report!
This is indeed a bug. I opened a PR to fix it.
Sadly, I don't think we will be able to release this on v5 (the current version), but it will be available in v6, which is now in beta and will be stable in the upcoming weeks. Is that a deal breaker for you?
@DiegoAndai Thanks for quick reaction. It is not a deal breaker as whole project relies on MUI anyway, but the sooner it is fixed the better. It is probably an accessibility issue as content is read by screen readers even if it is visually hidden.
Steps to reproduce
Link to live example: (required) Demo in Stackblitz : https://stackblitz.com/edit/react-qkjzbj?file=Demo.tsx Steps:
.MuiBadge-badge
elements in dev toolsCurrent behavior
Badge
withshowZero={false}
content of.MuiBadge-badge
element will not be updated (will still be 8, depite of element being not visible)Badge
withshowZero={true}
content of.MuiBadge-badge
element will be updatedExpected behavior
I believe this is wrong and content should updated to current value, even if element is not visible
Context
I am using Badge component and while testing if it visually hidden and has zero value when value is changed from anything other than 0 tests are failing because element is hidden but old value is present in the DOM.
Your environment
``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```npx @mui/envinfo
Search keywords: MuiBadge