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

MUI V5 precedence - nested classes? #38

Closed
JohnnyCrazy opened this issue Nov 18, 2021 · 5 comments
Closed

MUI V5 precedence - nested classes? #38

JohnnyCrazy opened this issue Nov 18, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@JohnnyCrazy
Copy link

JohnnyCrazy commented Nov 18, 2021

Hi there,

I'm currently trying out tss-react and noticed a roadblock, which I'm not sure how to solve it: I'm unable to change the color of the deleteIcon of a Chip since the original styles take precedence. I also followed the steps of the README, see here for a repro: https://stackblitz.com/edit/tss-react-aupnsq?file=Hello.tsx

As you can see, overriding the color in the theme works, but individually styling it with withStyles creates the wrong class order.

image

Am I missing something obvious? Do I maybe somehow have to specify MuiButtonBase-root-MuiChip-root so it it's on the same level?

@JohnnyCrazy
Copy link
Author

Maybe related to mui/material-ui#28664 and not even in the scope of tss-react 🤔

@garronej
Copy link
Owner

Damn it, it's not the expected behaviour indeed. Probably something that need to be addressed on the mui side though.
I will investigate with them.
In the meantime the only workaround I can suggest is this: https://stackblitz.com/edit/tss-react-wfuji8?file=Hello.tsx

Thank you for reporting

@garronej garronej added the bug Something isn't working label Nov 18, 2021
@garronej
Copy link
Owner

I have opened an issue about it.

In the meantime, since it looks like to be specifically related to the <Chip/> component you could use && to increase specificity:

const ChipStyled= withStyles(Chip, { 
    "deleteIcon": {
        "&&":{
            "color": "red"
        }
    }
});

@garronej
Copy link
Owner

garronej commented Dec 8, 2021

They closed it. So do I. I don't think it's up to me. Reopen if you think otherwise.

@garronej garronej closed this as completed Dec 8, 2021
@JohnnyCrazy
Copy link
Author

Sounds good, ty for the fast help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants