Skip to content
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

[Accordion][joy-ui] Unexpected character } in the class name, warnings in the console when using own color, variant or size #38688

Closed
2 tasks done
Bestwebdesign opened this issue Aug 28, 2023 · 4 comments · Fixed by #38950
Assignees
Labels
bug 🐛 Something doesn't work component: accordion This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy

Comments

@Bestwebdesign
Copy link
Contributor

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Steps to reproduce 🕹

Link to live example:
https://stackblitz.com/edit/react-ycprbf?file=Demo.js

Steps:

  1. Open the attached link
  2. Inspect the root element of the AccordionGroup component to see a class name containing an unexpected character }.
  3. Open console to see the warning:

Warning: Failed prop type: Invalid prop color of value secondary supplied to ForwardRef(AccordionGroup), expected one of ["danger","neutral","primary","success","warning"].

Current behavior 😯

The attached file demonstrates two issues:

  1. The class name generated for the selected size contains an unexpected character }, example: MuiAccordionGroup-sizeMd}.
  2. Passing own color, variant or size to the AccordionGroup component generates a warning in the console.

Expected behavior 🤔

  1. The class name should not contain } at the end.
  2. Using your own color, variant or size should not generate a warning in the console.

Context 🔦

No response

Your environment 🌎

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@Bestwebdesign Bestwebdesign added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 28, 2023
@sai6855
Copy link
Contributor

sai6855 commented Aug 29, 2023

The class name should not contain } at the end.

It's coming from this line, i'm opening a PR
https://github.com/mui/material-ui/blob/master/packages/mui-joy/src/AccordionGroup/AccordionGroup.tsx#L28

EDIT:
PR: #38695

@sai6855
Copy link
Contributor

sai6855 commented Aug 29, 2023

Not really sure what's the appropriate fix for console warnings when custom sizes are used. I'll let @siriwatknp answer this

@sai6855 sai6855 added component: accordion This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy bug 🐛 Something doesn't work and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Aug 29, 2023
@siriwatknp
Copy link
Member

@sai6855 custom color should not produce a warning. The proptype is missing PropTypes.string, would you like to fix this?

- color: PropTypes.oneOf(['danger', 'neutral', 'primary', 'success', 'warning']),
+ color: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([
+     PropTypes.oneOf(['danger', 'neutral', 'primary', 'success', 'warning']),
+     PropTypes.string,
+   ]),

@sai6855
Copy link
Contributor

sai6855 commented Sep 12, 2023

Yup, I'll open a PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: accordion This is the name of the generic UI component, not the React module! package: joy-ui Specific to @mui/joy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants