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

Add text-wrap: pretty; as a global toggle option #55190

Open
jasmussen opened this issue Oct 10, 2023 · 25 comments
Open

Add text-wrap: pretty; as a global toggle option #55190

jasmussen opened this issue Oct 10, 2023 · 25 comments
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.

Comments

@jasmussen
Copy link
Contributor

jasmussen commented Oct 10, 2023

The CSS feature text-wrap: pretty; enables line-breaks to happen in a way that avoids typographic widows. You can read a bit more here, although that refers to balance where pretty works slightly differently. The example from that post, shown here, features a typographic widow:

One year on and what next for remote
working?

The CSS property "balanced" would enable that heading to wrap instead like this:

One year on and what
next for remote working?

The other one, "pretty", would wrap it specifically to avoid the typographic widow:

One year on and what next for
remote working?

The feature is useful for headings and captions especially, and it would be nice if there was a way to apply this in the block editor.

Proposed solution

In global styles, as part of the typography panel, add options to adjust the text-balance:

Text-Wrap i4

These properties should ideally show up only in Global Styles, as they are not useful on a per-block basis.

**Note: ** text-wrap: pretty; still isn't supported in safari & firefox. So if that option is chosen, it should should add text-wrap: balance; as a fallback.

See #62233 for an example

Issue updated Aug 13.

@jasmussen jasmussen added [Type] Enhancement A suggestion for improvement. Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json labels Oct 10, 2023
@richtabor
Copy link
Member

Related in part: #48202

@simison

This comment was marked as resolved.

@jasmussen

This comment was marked as resolved.

@jasmussen jasmussen changed the title Add text-wrap: balance; as a global toggle option Add text-wrap: pretty; as a global toggle option Dec 11, 2023
@hanneslsm
Copy link

Somehow related: While text-wrap: pretty is something worth exploring, adding manually line-breaks would be also very beneficial: #55565 Both features could also work well together.

@richtabor
Copy link
Member

I've found a combination of both to work nicely:

/* Progresive enhancement to reduce widows and orphans. */
h1, h2, h3, h4, h5, h6, blockquote, caption, figcaption {
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

@jasmussen

This comment was marked as resolved.

@MaggieCabrera
Copy link
Contributor

Would this be something we ever surface as a control in the UI too or just theme.json?

@ramonjd ramonjd added the [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi label Jun 28, 2024
@jasmussen

This comment was marked as outdated.

@jasmussen

This comment was marked as outdated.

@benniledl

This comment was marked as outdated.

@jasmussen

This comment was marked as outdated.

@benniledl

This comment was marked as outdated.

@jasmussen

This comment was marked as outdated.

@benniledl

This comment was marked as outdated.

@fabiankaegy
Copy link
Member

Also just noting that text-wrap: pretty still isn't supported in safari & firefox. So we should add text-wrap: balance as a fallback.

See #62233 for an example

@jasmussen

This comment was marked as outdated.

@jameskoster

This comment was marked as resolved.

@jasmussen

This comment was marked as outdated.

@jameskoster

This comment was marked as resolved.

@jasmussen

This comment was marked as resolved.

@jameskoster

This comment was marked as resolved.

@jasmussen jasmussen added the Needs Dev Ready for, and needs developer efforts label Aug 13, 2024
@jasmussen jasmussen moved this from Next to Needs Dev in Design priorities Aug 13, 2024
@jasmussen
Copy link
Contributor Author

Updated the issue and shuffled the labels to indicate, this is ready!

@Drivingralle
Copy link

I like the idea.
My suggestion to make the effort of adding another control to the interface even more valuable, to also add the setting of "nowrap".

That can be very useful while creating websites with lists or tables full of details that should not be wrapped. like pricing tables.

@hanneslsm

This comment was marked as resolved.

@jasmussen
Copy link
Contributor Author

My suggestion to make the effort of adding another control to the interface even more valuable, to also add the setting of "nowrap".

Nowrap is included as the "None" option, with additional help-text below.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json Needs Dev Ready for, and needs developer efforts [Type] Enhancement A suggestion for improvement.
Projects
Status: Needs Dev
Development

No branches or pull requests