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 label not vertically aligned correctly #2714

Open
cheema-corellian opened this issue Apr 29, 2024 · 2 comments
Open

Button label not vertically aligned correctly #2714

cheema-corellian opened this issue Apr 29, 2024 · 2 comments
Assignees
Labels
bug Results from a bug in the CSS implementation

Comments

@cheema-corellian
Copy link

cheema-corellian commented Apr 29, 2024

Description

The text label for the button component does not vertically align correctly. Whenever I apply Spectrum CSS, either to a plane div or an Aria button, the text is always a little lower than it ought to be. Surprisingly, the React Spectrum button renders the text at the correct alignment. See screenshot below.

Steps to reproduce

  1. I have created a stackblitz for it that will show the problem on any computer. Feel free fork it and make changes as desired.

https://stackblitz.com/edit/stackblitz-starters-3grm8x?file=app%2Fpage.tsx

  1. Be sure to zoom in. The discrepancy may not be clearly visible on all screen sizes.

Expected behavior

The button, created by following directions on Spectrum-CSS website, should have its text be vertically aligned. Similar to the way React Spectrum button appears.

Screenshots

image

Button to the left was generated using spectrum-css, the middle one was generated using Adobe React Aria with spectrum-css style applied. The one to the right was generated using Adobe React Spectrum. The linked stackblitz code above demos all 3 of them.

Fonts are the same in all cases. The difference is ever so small. But it it clearly visible.

Environment

Tested on the latest Firefox, Edge and Chrome on Windows. And also using Chrome on Mac. The difference on Mac is less pronounced, but is there when measured with a tool.

@cheema-corellian cheema-corellian added the bug Results from a bug in the CSS implementation label Apr 29, 2024
@pfulton
Copy link
Collaborator

pfulton commented May 1, 2024

@cheema-corellian Thanks for looking into this and taking the time to put together the Stackblitz example.

It looks like your example might be loading different fonts for the examples—can you make sure that all three are using Adobe Clean?

@cheema-corellian
Copy link
Author

Thanks for getting back to me. This issue does not appear to be font related. All 3 buttons in the Stackblitz were using the exact same default font. I have updated the example, so now all 3 buttons now explicitly use the same Adobe Clean font.

There appears to be uneven padding for button labels in spectrum-css that impacts html buttons and React Aria buttons, if they use spectrum-css. React Spectrum doesn't appear to use the same button label class and therefore doesn't suffer from this problem. See screenshot below.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Results from a bug in the CSS implementation
Projects
None yet
Development

No branches or pull requests

3 participants