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.

[LinearProgress] `color="action.disabled"` is crashing

See original GitHub issue

<LinearProgress color="primary" /> works. <LinearProgress color="action.disabled" /> does not work (crash) <LinearProgress color="inherit" sx={{ color: "action.disabled" }} /> works as expected (workaround)

For example, These things work as expected: <Typography color="action.disabled">qwe</Typography> <Typography color="primary">qwe</Typography> <Typography color="primary.dark">qwe</Typography>

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, May 10, 2022

It’s to be notted that in these two examples:

<LinearProgress color="primary" />
<LinearProgress color="inherit" sx={{ color: "action.disabled" }} />

the color does not behave the same way. The color logic is vastly different, so I’m not sure that supporting:

<LinearProgress color="action.disabled" />

would be a step forward. Maybe the root problem is that we call the prop color. maybe if it was called differently, like:

<LinearProgress palette="primary" />

then it would be clear.

0reactions
socketpaircommented, May 10, 2022

Thanks for opening this issue @socketpair! @hbjORbj I agree with the OP that this inconsistency is worth addressing. I would also expect to be able to use the same values for the same props across these components, and would be frustrated when it doesn’t work. sweat_smile

I think we have three options here:

  1. change the prop names (which could get ugly, because how would you rename something like color?)
  2. make it so the props accept the same values (I don’t know how complex this might be behind the scenes)
  3. leave the API as is and add a caution note in the docs (simplest solution but doesn’t address the underlying inconsistency)
  1. Make components accept either variant of specifying color. I don’t vote for this option, but anyway.

I would advice make two new props:

  1. paletteColor where one can specify “primary”, “secondary”, “warning”, and so on.
  2. explicitColor where one can set values like “action.disabled”.
  3. announce deprecation of bare color prop.
Read more comments on GitHub >

github_iconTop Results From Across the Web

youtube-danmaku - Codul sursă - Greasy Fork
eslint-enable prefer-template */ } /* eslint-disable no-use-before-define ... error but do we really // want to crash if focus-visible malfunctioned?
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