[SvgIcon] Stroke color not inherited correctly
@siriwatknp is already working on this.
Since Jun 20, 2022.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
Duplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
When setting the color prop on an instance of SvgIcon, the fill property is properly overridden, but the stroke property is not, resulting in strokes being invisible (or whatever the default in the SVG markup is).
Expected behavior 🤔
stroke should inherit value from the color prop, same as fill does. FIx should be as simple as adding stroke: 'currentColor' to the component CSS, same as there already is for fill. I'm happy to put up a PR to fix this if that indeed is the desired behavior (and there are no concerns about unintended side effects).
Steps to reproduce 🕹
Steps:
Sandbox: https://codesandbox.io/s/reverent-golick-hifz71
- Notice the circle is visible, but the line is not
- Add
stroke="currentColor"to theSvgIcon - Notice the circle and line are both visible now
Context 🔦
Creating a custom SVG icon that uses a mix of circles and lines.
Your environment 🌎
I couldn't get @mui/envinfo to run, but I'm on Firefox 100.0, @mui/material 5.8.0 and @mui/icons-material 5.8.0
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.