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

[Chip] Fix error when theme value is a CSS variable #36654

Merged
merged 2 commits into from
Mar 28, 2023

Conversation

siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Mar 27, 2023

Before: https://codesandbox.io/s/joy-ui-feat-material-ui-forked-cw0rw5?file=/demo.tsx

Problem

Chip throws an error if you have custom theme value that is a CSS variable:

const theme = extendTheme({
  colorSchemes: {
    light: {
      palette: {
        text: {
          primary: 'var(--mui-palette-grey-900)',
          primaryChannel: '12 12 12',
        },
      },
    },
  },
});

<CssVarsProvider theme={theme}>
  <Chip label="chip" />
</CssVarsProvider>

This is because the calculation of deleteIconColor with alpha() is done before checking theme.vars.


@siriwatknp siriwatknp added bug 🐛 Something doesn't work component: chip This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material labels Mar 27, 2023
@mui-bot
Copy link

mui-bot commented Mar 27, 2023

Netlify deploy preview

https://deploy-preview-36654--material-ui.netlify.app/

Bundle size report

Details of bundle changes

Generated by 🚫 dangerJS against 6106702

@siriwatknp siriwatknp mentioned this pull request Mar 28, 2023
1 task
Copy link
Member

@mj12albert mj12albert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good !

@mj12albert mj12albert merged commit d3be5e7 into mui:master Mar 28, 2023
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: chip This is the name of the generic UI component, not the React module! package: material-ui Specific to @mui/material
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants