Skip to content

Apply line-height 0 for iconOnly buttons #6666

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

Merged
merged 1 commit into from
Mar 6, 2023
Merged

Apply line-height 0 for iconOnly buttons #6666

merged 1 commit into from
Mar 6, 2023

Conversation

taysea
Copy link
Collaborator

@taysea taysea commented Mar 6, 2023

What does this PR do?

Applies line-height: 0 for icon-only buttons. This is a required fix for Safari and does not have any visual effects on other browsers. Safari improperly determined a button's dimensions in cases where only icon property was applied, no label.

Where should the reviewer start?

src/js/components/Button/StyledButtonKind.js

What testing has been done on this PR?

See screenshots below. Tested locally in storybook using NEXT branch of grommet-theme-hpe. This can also be tested directly in a browser (current HPE Design System site exhibits this bug. For example, the "Search" button in main header has 39px height as opposed to 36px). Applying line-height 0 to the button fixes it.

How should this be manually tested?

See above notes.

Do Jest tests follow these best practices?

  • screen is used for querying.
  • The correct query is used. (Refer to this list of queries)
  • userEvent is used in place of fireEvent.
  • asFragment() is used for snapshot testing.

Any background context you want to provide?

What are the relevant issues?

Closes #6667

Screenshots (if appropriate)

BEFORE
Screen Shot 2023-03-06 at 10 08 04 AM

AFTER
Screen Shot 2023-03-06 at 10 07 52 AM

BEFORE (grommet-theme-hpe NEXT)
Screen Shot 2023-03-06 at 9 54 29 AM

AFTER
Screen Shot 2023-03-06 at 9 54 42 AM

Do the grommet docs need to be updated?

No.

Should this PR be mentioned in the release notes?

Yes.

Is this change backwards compatible or is it a breaking change?

Backwards compatible.

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@ericsoderberghp ericsoderberghp merged commit 8f9c0c9 into grommet:master Mar 6, 2023
@taysea taysea deleted the safari-icon-only branch March 6, 2023 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Safari icon-only buttons render incorrect dimensions
4 participants