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

Block-Editor: Enhance FontFamily Component #57430

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

Utsav-Ladani
Copy link

What?

  • This PR changes the FontFamily component in the block-editor package.

Why?

  • In the current version, the font list becomes too much taller (same as the screen width) in Chrome because SelectControl uses the <select> HTML tag.
  • If we use CustomSelectControl then the list will not become taller, it get a scrollbar if necessary and our UI stays the same for all different browsers.

How?

  • It replaces SelectControl with CustomSelectControl to solve the issue.
  • The CustomSelectControl uses a custom interface for the select menu, however, SelectControl uses the default <select> tag which is different in all browsers.

Testing Instructions

  1. Create a post.
  2. Add paragraph block.
  3. Write some text to it.
  4. Select the block and open the sidebar panel.
  5. Enable font family in the Typography panel.
  6. Try to select different fonts from the drop-down box and see the result.

Screenshots

Screenshot 2023-12-28 at 10 35 12 PM

Related issue

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Dec 28, 2023
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @Utsav-Ladani! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

Copy link

@JuanLucha JuanLucha left a comment

Choose a reason for hiding this comment

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

Great work!
I have enabled Jetpack Google Fonts (beta) to have a scrollable dropdown of fonts in the Font Family field. It works great, having a consistent experience across browsers.

Firefox:
https://github.com/WordPress/gutenberg/assets/3832570/8a792ef9-d322-4514-a66a-253d8bbc2ed6

Chrome:
https://github.com/WordPress/gutenberg/assets/3832570/5faa986f-c4d2-48d0-8cc2-39cad2813512

@akasunil
Copy link
Member

@Utsav-Ladani can you sync PR with trunk?

Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Unlinked Accounts

The following contributors have not linked their GitHub and WordPress.org accounts: @JuanLucha.

Contributors, please read how to link your accounts to ensure your work is properly credited in WordPress releases.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Unlinked contributors: JuanLucha.

Co-authored-by: Utsav-Ladani <utsavladani@git.wordpress.org>
Co-authored-by: akasunil <sunil25393@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@akasunil akasunil added the [Feature] Typography Font and typography-related issues and PRs label Jul 28, 2024
When we have too many fonts, SelectControl shows font list whose height is equal to screen height in the Chrome. But in Firefox height is not that much larger.

SelectControl uses default HTML select interface, however CustomSelectControl uses custom interface, so user can see scrollable list instead of taller list. This way we can enhacne the UI

Fixes WordPress#57301.
@Utsav-Ladani Utsav-Ladani force-pushed the update/font-family-component branch from af6129f to 0470bb5 Compare July 28, 2024 11:10
@Utsav-Ladani
Copy link
Author

@Utsav-Ladani can you sync PR with trunk?

@akasunil done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Typography Font and typography-related issues and PRs First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants