question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Wrong color applied to link when overriding MUI theme

See original GitHub issue

We have a Next.js application that we are in the midst of upgrading from MUI v4 to MUI v5 with react-tss. Part of our theme file is as follows:

MuiLink: {
  styleOverrides: {
    root: {
      color: '#0068b5',
      textDecoration: 'none',
    },
    underlineNone: {
      color: '#f9f9f6',
    },
  },
  defaultProps: {
    underline: 'hover',
  },
},

In MUI v4, this color was correctly applied. However, in MUI v5 with react-tss, our link styles look like this:

image

It appears that instead of replacing the original color CSS property the new color is simply being added as an additional property. And unfortunately, probably based on the order styles are applied, the wrong color is taking precedence over the desired color. Any ideas here?

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
sdornancommented, Apr 15, 2022

That is the result I’d expect, but not the result I’m getting in my app. I’ll continue to investigate and follow-up here.

Thanks for your help so far!

0reactions
garronejcommented, May 3, 2022

Hi,
Could you give a try with the latest Next.js, react-dom and React version?

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Link] color cannot be overwritten by styleOverrides #32574
Current behavior 😯 When using MuiLink with a specific color we are unable to overwrite the color in styleOverrides. The result is that...
Read more >
Material UI - Theme is overriding the wrong component
I've made two Material-UI components. Both are using themes. However, the overrides on one theme ...
Read more >
How to customize - Material UI - MUI
Overriding styles with class names​​ To override the styles of a specific part of the component, use the global classes provided by Material...
Read more >
Theming - Material UI - MUI
The theme specifies the color of the components, darkness of the surfaces, level of shadow, appropriate opacity of ink elements, etc.
Read more >
Palette - Material UI - MUI
The theme exposes the following palette colors (accessible under theme.palette. ): ... Having it is optional. error - used to represent interface elements...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found