material-ui icon indicating copy to clipboard operation
material-ui copied to clipboard

[Button] Text wrap issue

Open oliviertassinari opened this issue 2 years ago • 19 comments

Duplicates

  • [X] I have searched the existing issues

Latest version

  • [X] I have tested the latest version

Steps to reproduce 🕹

Link to live example:

Steps:

  1. https://codesandbox.io/s/inspiring-browser-c7qmv7?file=/Demo.tsx

Current behavior 😯

Screenshot 2023-08-27 at 20 33 12

Expected behavior 🤔

Screenshot 2023-08-27 at 20 33 05

Context 🔦

It looks more correct on Material UI:

Screenshot 2023-08-27 at 20 38 13

https://codesandbox.io/s/peaceful-khorana-27gct9

but a lower line-height would I think feel better.

Your environment 🌎

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

oliviertassinari avatar Aug 27 '23 18:08 oliviertassinari

Hi ,can I work on this if it is open?

sofiyanpathan avatar Sep 16 '23 09:09 sofiyanpathan

Hi ,can I work on this if it is open?

Thanks for asking! The PR is already there, would you mind taking a look at other issues?

siriwatknp avatar Sep 18 '23 03:09 siriwatknp

I checked on Material UI v6, it looks ok: https://mui.com/material-ui/react-button/#material-you-version

Screenshot 2023-09-18 at 23 46 43

cc @DiegoAndai. I wouldn't mind -1px on padding-top and padding-bottom though:

Screenshot 2023-09-18 at 23 50 16

Actually, should we rename "Material You version" to something like "Material UI v6 (alpha)"?

Screenshot 2023-09-18 at 23 48 47

oliviertassinari avatar Sep 18 '23 21:09 oliviertassinari

Is this issue still open, so that I can work on this.

Praveen03AJJARAPU avatar Sep 30 '23 13:09 Praveen03AJJARAPU

Hey,Is this issue still open, so that I can work on this.

akshayw1 avatar Oct 01 '23 17:10 akshayw1

@Praveen03AJJARAPU @akshayw1 Thanks for asking, the Joy PR is already up. On the Material line height, we should define it before working on it.

but a lower line-height would I think feel better.

@oliviertassinari @zanivan, what should we use for the line height? Would we change it for buttons with text wrapping only?

Regarding v6 (https://github.com/mui/material-ui/issues/38675#issuecomment-1724503276)

  • I split the Material UI docs feedback into a separate issue: https://github.com/mui/material-ui/issues/39266
  • The padding follows the specs, so I would only decrease 1px if we had a really good reason. What do you think, @zanivan?

DiegoAndai avatar Oct 02 '23 14:10 DiegoAndai

what should we use for the line height?

@DiegoAndai I'm not familiar with the implementation, to consider the impact on the design tokens. Maybe it's not worth it. In v5, If I recall the code correctly, this isn't a concern.

At the end of the day, I think the UX should win over other considerations, like following exactly the design token structure. I mean, we should aim to make the same tradeoffs designers & engineers would want to make.

Would we change it for buttons with text wrapping only?

I don't think developers or the code can know if a button wraps. In most cases, it's not supposed to (this issue is about minimizing the worst case scenario when a button needs to wrap to fit in the layout).

oliviertassinari avatar Oct 02 '23 15:10 oliviertassinari

Hello is the issue still open can i pull and solve it ?

hetpatel4381 avatar Oct 02 '23 16:10 hetpatel4381

Hello, I'd like to inquire if the issue is still available for me to pull and work on?

ShaikhHeeba07 avatar Oct 06 '23 09:10 ShaikhHeeba07

Hey, @ShaikhHeeba07 @hetpatel4381 thanks for asking! We already have two undergoing PRs for the Joy UI line height on buttons, the #38696 and #39316 :)

zanivan avatar Oct 06 '23 12:10 zanivan

Hello! Is the issue still open? If yes, can I work on it?

Riyanshi26 avatar Oct 12 '23 09:10 Riyanshi26

Hi @oliviertassinari - can you please assign this issue to me ?

ArchitGajjar avatar Dec 29 '23 07:12 ArchitGajjar

Hello, I'd like to know if this issue is still persist for me to pull and work on?

anuragsingh6886 avatar Feb 23 '24 11:02 anuragsingh6886

hi , can i work on this

sreeragdas avatar Apr 09 '24 12:04 sreeragdas

Hi, let me know if I can start working on it. Looking to start my open source journey. Thanks

geekngoyal avatar Apr 09 '24 13:04 geekngoyal

@zanivan What should be the line-height for Material UI Button?

siriwatknp avatar Apr 10 '24 05:04 siriwatknp

@zanivan What should be the line-height for Material UI Button?

On Material Design 2 the line-height is 1.5. Material Design 3 uses 1.25. Currently, if I'm not mistaken, we're using 1.75 on buttons. So, making it 1.5 would suit the MD2 guidelines and make spacing more consistent with padding, e.g.:

1.75 1.5
Screenshot 2024-04-10 at 10 15 16 Screenshot 2024-04-10 at 10 15 30

zanivan avatar Apr 10 '24 13:04 zanivan

For anyone who is interested to submit a PR, here is the fix:

diff --git a/packages/mui-material/src/styles/createTypography.js b/packages/mui-material/src/styles/createTypography.js
index 277808d2a7..32b5e9f790 100644
--- a/packages/mui-material/src/styles/createTypography.js
+++ b/packages/mui-material/src/styles/createTypography.js
@@ -69,7 +69,7 @@ export default function createTypography(palette, typography) {
     subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
     body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
     body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
-    button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
+    button: buildVariant(fontWeightMedium, 14, 1.5, 0.4, caseAllCaps),
     caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
     overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
     // TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types.

siriwatknp avatar Apr 12 '24 02:04 siriwatknp

For anyone who is interested to submit a PR, here is the fix:

diff --git a/packages/mui-material/src/styles/createTypography.js b/packages/mui-material/src/styles/createTypography.js
index 277808d2a7..32b5e9f790 100644
--- a/packages/mui-material/src/styles/createTypography.js
+++ b/packages/mui-material/src/styles/createTypography.js
@@ -69,7 +69,7 @@ export default function createTypography(palette, typography) {
     subtitle2: buildVariant(fontWeightMedium, 14, 1.57, 0.1),
     body1: buildVariant(fontWeightRegular, 16, 1.5, 0.15),
     body2: buildVariant(fontWeightRegular, 14, 1.43, 0.15),
-    button: buildVariant(fontWeightMedium, 14, 1.75, 0.4, caseAllCaps),
+    button: buildVariant(fontWeightMedium, 14, 1.5, 0.4, caseAllCaps),
     caption: buildVariant(fontWeightRegular, 12, 1.66, 0.4),
     overline: buildVariant(fontWeightRegular, 12, 2.66, 1, caseAllCaps),
     // TODO v6: Remove handling of 'inherit' variant from the theme as it is already handled in Material UI's Typography component. Also, remember to remove the associated types.

Hi, I am interested to Contribute with MUI and it would be an start point if this issue is not assigned to anyone Can I work on it?

successbyte avatar May 06 '24 13:05 successbyte

Hello everyone can you guide me how to pass the checks please!

successbyte avatar Jun 02 '24 12:06 successbyte