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

Font Size Picker: Add truncation to header hint and adjust styles #68452

Open
wants to merge 2 commits into
base: trunk
Choose a base branch
from

Conversation

yogeshbhutkar
Copy link
Contributor

@yogeshbhutkar yogeshbhutkar commented Jan 2, 2025

What, Why & How?

When the hint text is too long, it overflows and disrupts the layout, as noted in the original issue. A potential solution was suggested in this comment. However, as mentioned, manipulating the height breaks the layout.

Ideally, excessively long hint text should be truncated to fit within the available space, ensuring it neither overflows nor causes layout inconsistencies.

This PR introduces text truncation to resolve the overflow issue. The full hint text remains accessible to users via tooltips on hover, offering a practical balance between usability and layout stability.

Testing Instructions

  1. Add the following snippet to the theme.json.
"typography": {
	"defaultFontSizes": false,
	"fontSizes": [
		{
			"fluid": false,
			"name": "Small small small small small small small small small small small small small small small",
			"size": "0.875rem",
			"slug": "small"
		}
	]
}
  1. Navigate to editing a page.
  2. Notice the hint text overflow is now fixed.

Screenshots

Before After
Screenshot 2025-01-02 at 10 10 04 AM Screenshot 2025-01-02 at 10 10 45 AM

Layout

Screenshot 2025-01-02 at 10 11 04 AM

Screencast

Screen.Recording.2025-01-02.at.10.11.22.AM.mov

Closely related to: #68280

Closes: #68344

@yogeshbhutkar yogeshbhutkar marked this pull request as ready for review January 2, 2025 05:13
Copy link

github-actions bot commented Jan 2, 2025

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.

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

Co-authored-by: yogeshbhutkar <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: snehapatil2001 <[email protected]>

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

@t-hamano
Copy link
Contributor

t-hamano commented Jan 2, 2025

There are two approaches to solving this problem:

It might be worth discussing which approach to take in more detail in #68344.

@t-hamano t-hamano added Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Feature] Typography Font and typography-related issues and PRs [Type] Bug An existing feature does not function as intended labels Jan 2, 2025
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 Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Site Editor Layout Breaks When changing existing names of Font Sizes with Long Names in theme.json
2 participants