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] Vertical text alignement issue on Firefox #23637

Closed
2 tasks done
jasminnancy opened this issue Nov 20, 2020 · 6 comments
Closed
2 tasks done

[Button] Vertical text alignement issue on Firefox #23637

jasminnancy opened this issue Nov 20, 2020 · 6 comments
Labels
component: button This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information

Comments

@jasminnancy
Copy link

jasminnancy commented Nov 20, 2020

  • 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 😯

Buttons do not render properly with correct padding. As you can see, the text looks raised and is higher than it should be. While this seems like a small issue, it is noticeable when using rounded buttons and is an issue in production.
squareArtboard 12x-80

Screen Shot 2020-11-20 at 11 05 28 AM

No amount of `button::-moz-focus-inner` or any other found solution does the trick.

Expected Behavior 🤔

Button should render with text centered.
Screen Shot 2020-11-20 at 11 05 07 AM

Steps to Reproduce 🕹

Edit Material-UI issue (forked)

Steps:

  1. Import and create button
  2. Open button on Chrome and Firefox
  3. See that padding is different

Context 🔦

This is an issue, mostly, for buttons that have rounded edges. It's fairly noticeable and frustrating, especially since we can't get it to stop doing this. Can you possibly add Firefox support for this so it stops happening automatically?

Your Environment 🌎

Tech Version
Material-UI v4.9.9
React v16.13.1
Browser Firefox
@jasminnancy jasminnancy added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Nov 20, 2020
@oliviertassinari oliviertassinari changed the title [Button] Add support to remove Firefox's extra padding [Button] Vertical alignement issue on Firefox Nov 21, 2020
@oliviertassinari oliviertassinari changed the title [Button] Vertical alignement issue on Firefox [Button] Vertical text alignement issue on Firefox Nov 21, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Nov 21, 2020

@jasminnancy Do you have a better reproduction? It almost displays aligned for me on Firefox 83 macOS:

Capture d’écran 2020-11-21 à 21 50 07

Firefox 82 Windows 10

Capture d’écran 2020-11-21 à 21 54 02

Vertical alignment of text inside a button is tricky! Different fonts have a different alignment of the baseline compare to the ascender and descender.

@oliviertassinari oliviertassinari added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 21, 2020
@oliviertassinari oliviertassinari added the component: button This is the name of the generic UI component, not the React module! label Nov 24, 2020
@mkarajohn
Copy link

mkarajohn commented Jan 12, 2021

This is definitely an inconsistency with some fonts @jasminnancy , especially prevalent when icons are in there as well

Firefox on Linux
image

Chromium on Linux
image

This is actually a pretty old "issue" which has to do with the fact that FF is implementing font metrics accorrding to spec, while the Chromium browsers are not.

See

Could this be fixed on the font level @oliviertassinari ? There are some fonts that work the same on both browsers, but Roboto ain't one of them. Turns out I had not actually loaded the Roboto font 😅 The Ubuntu font for example looks the same on both browsers

Chromium on Linux
image

Firefox on Linux
image

@lcdss
Copy link

lcdss commented Apr 19, 2021

Same thing here with Material-ui 5.0.0-alpha.29.

Firefox Developer Edition 88 on Linux:
firefox-developer-edition

Chromium 90 on Linux:
chromiun

@oliviertassinari
Copy link
Member

@lcdss Do you have a codesandbox? Is it related to a custom font?

@lcdss
Copy link

lcdss commented Apr 20, 2021

@lcdss Do you have a codesandbox? Is it related to a custom font?

This only happens on Firefox (as far as I have tested) and I'm not using a custom font. Problably this is related to #19584.

#19584 (comment)

@Misaka-0x447f
Copy link

A simple workaround: just not to use roboto would fix that.

  typography: {
    fontFamily: `inherit`,
  },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: button This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

5 participants