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

SelectControl: Remove the line height setting to fix issue with font descenders being cut off #40985

Merged
merged 2 commits into from
May 12, 2022

Conversation

glendaviesnz
Copy link
Contributor

@glendaviesnz glendaviesnz commented May 11, 2022

What?

Removes the fixed lineheight 1 the SelectControl component

Why?

In places like the Gallery block Image size selector this lineheight setting causes font descenders to be cut off

Fixes: #27194

How?

Just removes the lineheight setting and allows it to be inherited

Testing Instructions

  • Add a Gallery block and upload an Image that will have a Large option
  • In the image size selector in the block inspector check that the descender of the g in the Large is not cut off
  • Check a range of other places where SelectControl is used, including Storybook, and make sure there are no unfortunate side effects

Screenshots or screencast

Before:
before

After:
after

@glendaviesnz glendaviesnz added the [Feature] UI Components Impacts or related to the UI component system label May 11, 2022
@glendaviesnz glendaviesnz self-assigned this May 11, 2022
@ramonjd
Copy link
Member

ramonjd commented May 11, 2022

This is looking good in viewports > 600px. There's a slight regression (about 1px) in narrower screen widths.

Before

Wide Narrow
Screen Shot 2022-05-12 at 8 15 09 am Screen Shot 2022-05-12 at 8 15 22 am

After

Wide Narrow
Screen Shot 2022-05-12 at 8 15 58 am Screen Shot 2022-05-12 at 8 16 09 am

But it's not a huge difference and I think the improvement at desktop widths appears worth it.

As far as I can tell a value of line-height: 1.1; makes things look better.

Screen Shot 2022-05-12 at 8 23 54 am

Copy link
Member

@ramonjd ramonjd left a comment

Choose a reason for hiding this comment

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

Left a note about narrow screens.

Happy to look again if there's a fix in this PR or a follow up.

@glendaviesnz
Copy link
Contributor Author

@ramonjd it seems like the following padding css from WP core is the cause of the issue:

.wp-core-ui select {
    padding: 5px 24px 5px 8px;
}

I have pushed an update which resets the top and bottom padding and this seems to fix the issue in wide and narrow screens now.

@ramonjd
Copy link
Member

ramonjd commented May 12, 2022

@glendaviesnz

More screenshots === LGTM!

💻

Screen Shot 2022-05-12 at 2 38 37 pm

Screen Shot 2022-05-12 at 2 38 42 pm

📱

Screen Shot 2022-05-12 at 2 38 31 pm

Screen Shot 2022-05-12 at 2 38 50 pm

@glendaviesnz glendaviesnz merged commit 28b9dc3 into trunk May 12, 2022
@glendaviesnz glendaviesnz deleted the fix/select-component-lineheight branch May 12, 2022 05:24
@github-actions github-actions bot added this to the Gutenberg 13.3 milestone May 12, 2022
@ciampo ciampo added [Type] Enhancement A suggestion for improvement. [Package] Components /packages/components labels May 19, 2022
@ciampo
Copy link
Contributor

ciampo commented May 19, 2022

Thank you for working on this ❤️

Just a small nit — when working in the components package, would you mind adding an entry to the CHANGELOG ? Thank you!

@ciampo ciampo changed the title Select Component: Remove the lineheight setting to fix issue with font descenders being cut off SelectControl: Remove the line height setting to fix issue with font descenders being cut off May 19, 2022
@glendaviesnz
Copy link
Contributor Author

Just a small nit — when working in the components package, would you mind adding an entry to the CHANGELOG ? Thank you!

Sure, thanks for the reminder, and thanks for adding the details for this one for me 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

in Gallery Block we are not able to view the character in drop down because of line height
3 participants