-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Try: text-wrap: pretty; across #58728
Conversation
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 Core SVNCore Committers: Use this line as a base for the props when committing in SVN:
GitHub Merge commitsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Size Change: +17.5 kB (+1%) Total Size: 1.71 MB
ℹ️ View Unchanged
|
This is an interesting proposal. Actually, when renewing the Rosetta site with a new design, I encountered a case where this On .org sites, WordPress/wporg-parent-2021#123 In languages such as Japanese and Chinese, there are basically no spaces between words. And if the value is On the other hand, I think it is necessary to be careful about what kind of behavior it causes in Western languages other than English or in RTL languages. If this proposal is to move forward, it might be a good idea to solicit broader input from the gutenberg core team. |
Fantastic feedback, thank you. I intentionally went super broad with the selector, with the intent of seeing: should we go more atomic instead? But it sounds like, correct me if I'm wrong, that regardless of where the property is applied, it will be a poor experience for east asian languages, in which case we definitely need a different approach. I wonder if we can do something like this:
or even the inverse:
it isn't clear how expensive this operation would be to me, it might be bad 🤔 |
At the very least, On a side note, it might be a good idea to add |
Oh so you're saying it doesn't make east asian languages worse, it just doesn't fix widows, is that right? In that case perhaps this PR can move forward after all, as a progressive enhancement?
Agree! #55190 |
That's right. If there are improvements, at least in Latin languages, I think it's okay to move forward with this PR. However, this will have a huge impact, so let me ask @WordPress/gutenberg-core for their opinion. |
@@ -31,6 +31,9 @@ html.interface-interface-skeleton__html-container { | |||
top: 0; | |||
} | |||
} | |||
|
|||
// This default value avoids widows in multi-line paragraphs of text. | |||
text-wrap: pretty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we want this to be really global, maybe we should add it to the "reset" mixin?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. Pending other thoughts, I'll move it there.
This seems fine to try. We certainly don't want to use |
Both MDN and Chromium dev docs raise some performance concerns around applying both Nevertheless maybe we can avoid battery draining operations by scoping this a bit more? |
Indeed. This one might work normally for webpages:
The main problem is it won't capture things like the block description, which is a
And if we include |
I think this could be added to |
Sorry about the delay, created #60164 as a followup. Closing in favor of that! |
What?
There's a new CSS property,
text-wrap: balance;
, which when applied to paragraphs of text makes it avoid unfortunate wrapping, specifically avoiding typographic widows. This PR applies the property very broadly — perhaps too broadly — so as to enable us to always avoid widows. The best way to demonstrate the effect is to show what happens if you intentionally edit a paragraph of text to add a typographic widow, as shown in this GIF:Nothing happens, i.e. the typographic widow is permitted. The CSS property when applied, causes the wrapping to change, to avoid typographic widows, ensuring there are at least two words on the last line of text, as shown in this GIF:
Avoiding typographic widows is important to do editorially, but even in the best cases, there will be cases where they can appear, such as responsive contexts, or in translations. This property would prevent that from happen.
An open question is how broadly we want to apply this, however. This PR intentionally makes it super broad; should it be scoped instead to
p
andh[n]
tags?Testing Instructions
Browse the editor, perhaps using the inspector try and force a typographic widow to appear, see that text re-wraps.