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

[Button] small button text not vertically centered with Roboto #29965

Open
2 tasks done
apokusin opened this issue Nov 30, 2021 · 9 comments
Open
2 tasks done

[Button] small button text not vertically centered with Roboto #29965

apokusin opened this issue Nov 30, 2021 · 9 comments

Comments

@apokusin
Copy link

@apokusin apokusin commented Nov 30, 2021

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

The text inside of a button with size="small" is not centered vertically. This is especially obvious when used with an icon or a contained/outlined button.

Expected behavior 🤔

The text inside of a button with size="small" is centered vertically.

Steps to reproduce 🕹

Steps:

  1. Use <Button size="small">text</Button>
  2. Observe text

Context 🔦

Codesandbox link

Screenshots:
Medium (alignment ok)
medium

Small (text too high)
small

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@mnajdova
Copy link
Member

@mnajdova mnajdova commented Nov 30, 2021

I can notice it. It could be a regression after the span wrapping the text was removed. @danilo-leal could you double-check this please?

@apokusin
Copy link
Author

@apokusin apokusin commented Nov 30, 2021

The CodeSandbox I've linked to above uses MUI 5.2.2, but I'm also seeing the issue as far back as 5.0.0-rc.0.

@danilo-leal
Copy link
Member

@danilo-leal danilo-leal commented Nov 30, 2021

I suppose it could be related to the text line-height. The tricky thing is that it seems the overall Button height is composed of the text line-height. In the below example, the texts are without line-hight which makes the Buttons smaller. They seem to be centered though.

Screen Shot 2021-11-30 at 16 38 21

If we were about to remove the typography variant button line-height, we should probably add a minHeight to each component size variant so they don't shrink. Does that make sense?

@siriwatknp
Copy link
Member

@siriwatknp siriwatknp commented Dec 15, 2021

If we were about to remove the typography variant button line-height, we should probably add a minHeight to each component size variant so they don't shrink. Does that make sense?

At this point, I suggest only adjusting to line-height: 1.5 for size small because changing to use minHeight in v5 might be a breaking change. In v6, we can revisit the size implementation again.

@oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Dec 17, 2021

I had noticed the same problem, on macOS 12, Chrome v96! I'm glad we have an issue open about this problem. @apokusin thanks for the care ❤️ .

The large text and outlined variant feels a bit off too:
Screenshot 2021-12-17 at 11 17 35
Screenshot 2021-12-17 at 11 17 41

@shagungarg0
Copy link

@shagungarg0 shagungarg0 commented Jan 11, 2022

can i work on this issue??

@abhinav-22-tech
Copy link
Contributor

@abhinav-22-tech abhinav-22-tech commented Jan 11, 2022

can i work on this issue??

#30240 This is already on hold.

@shagungarg0
Copy link

@shagungarg0 shagungarg0 commented Jan 11, 2022

can i work on this issue??

#30240 This is already on hold.

I am a beginner and target gsoc this year..can you guide me that how i should start??

@danilo-leal
Copy link
Member

@danilo-leal danilo-leal commented Jan 11, 2022

Hey @shagungarg0, thanks for the willingness to start working on this issue. However, @abhinav-22-tech already took the lead and opened the PR for it but given it is a breaking change, we put it on hold until the next major (can't give you a prediction when that will happen exactly though).

To find more good opportunities to contribute and learn, you can filter the issues with good to take and good first issues labels and look around if any of them get you interested!

@danilo-leal danilo-leal removed their assignment Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
7 participants