[IconButton] edge="start/end" not setting correct negative margins
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 99.1k
- Forks
- 32.5k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 106
Description
- The issue is present in the latest release.
- I have searched the issues of this repository and believe that this is not a duplicate.
Current Behavior 😯
<IconButton edge="start" size="small" /> Sets a left margin of -3 even though padding is 5
<IconButton edge="start" size="medium" /> Sets a left margin of -12 even though padding is 8
<IconButton edge="start" size="large" /> Sets a left margin of -12 even though padding is 12
Expected Behavior 🤔
<IconButton edge="start" size="small" /> Should set a left margin of -5 with a padding of 5
<IconButton edge="start" size="medium" /> Should set a left margin of -8 with a padding of 8
<IconButton edge="start" size="large" /> Should set a left margin of -12 with a padding of 12
Steps to Reproduce 🕹
No specific steps to reproduce besides rendering the component with the given props above.
Other observations
Also, don't think it is currently possible to override the styles via theme overrides for edge/negative margins for each respective size when looking at the overridesResolver here: https://github.com/mui-org/material-ui/blob/afcf3ee18e7a9c526348b3bce74b69781b4ad071/packages/mui-material/src/IconButton/IconButton.js#L32-L41
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.
Research direction
Start in packages/mui-material/src/IconButton/IconButton.js, especially the edge and size styling and the overridesResolver around lines 32–41. Compare the rendered negative margins with each size's documented padding for edge="start" and edge="end"; done means the margins match the padding values and the styles can be overridden through the theme.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100