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

styleOverrides is not working properly with MuiListItem #27464

Closed
barwalker opened this issue Jul 27, 2021 · 1 comment
Closed

styleOverrides is not working properly with MuiListItem #27464

barwalker opened this issue Jul 27, 2021 · 1 comment
Assignees

Comments

@barwalker
Copy link

Hi, I created a custom theme with a override style for MuiListItem. It's not working anymore after changed to Material-ui V5.

            MuiListItem: {
                styleOverrides: {
                    root: {
                        color: primary,
                        paddingTop: '12px',
                        paddingBottom: '12px',
                        '&$selected': {
                            color: theme === 'dark' ? '#e3f2fd' : '#3366ff',
                            backgroundColor: theme !== 'dark' ? '#e3f2fd' : '#5D4CA5',
                            '&:hover': {
                                backgroundColor: theme !== 'dark' ? '#e3f2fd' : '#5D4CA5',
                            },
                            '& .MuiListItemIcon-root': {
                                color: theme === 'dark' ? '#e3f2fd' : '#3366ff',
                            },
                        },
                        '&:hover': {
                            color: theme === 'dark' ? '#e3f2fd' : '#3366ff',
                            '& .MuiListItemIcon-root': {
                                color: theme === 'dark' ? '#e3f2fd' : '#3366ff',
                            },
                        },
                    },
                }
            }

Current Behavior:

When the List item clicked(selected), it doesn't has color and background color above.

Expected Behavior:

The selected style should be applied, and it works before, on V4.

What I need to change on this case, I read the migrate guide on next.material-ui.com but it doesn't help.
Thanks

@barwalker barwalker added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jul 27, 2021
@barwalker
Copy link
Author

The '&$selected' option need to change to '&.Mui-selected'.
Anyway, thanks for your hard work.

@mnajdova mnajdova self-assigned this May 23, 2022
@mnajdova mnajdova added v5.x migration and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels May 25, 2022
@mnajdova mnajdova closed this as not planned Won't fix, can't repro, duplicate, stale May 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants