Implement the hyphenate-limit-chars property
Categories
(Core :: Layout: Text and Fonts, enhancement, P3)
Tracking
()
People
(Reporter: hallo, Assigned: jfkthame)
References
(Blocks 1 open bug)
Details
(Keywords: dev-doc-complete, feature)
Attachments
(6 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 1521723 - Fix up incorrect expectations in WPT tests for hyphenate-limit-chars values. r=#layout
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review |
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:66.0) Gecko/20100101 Firefox/66.0
Steps to reproduce:
- Use CSS Hyphenation for a sentence
- Find out that it is also uses Hyphenation for very short words
- Try to find a solution and fail to do so
Actual results:
The hyphenate-limit-chars property is currently not supported in Firefox. It should work as the -ms-hyphenate-limit-chars property in IE/Edge: https://msdn.microsoft.com/en-us/library/hh771865(v=vs.85).aspx
Expected results:
The hyphenate-limit-chars property should be supported in Firefox, so developers can decide how many characters a word should have before hyphens are used and how many characters before/after the break should be the minimum.
Comment 1•6 years ago
|
||
I've moved the bug to a new component and the guys from there will bet an idea of what should o whit this.
Updated•6 years ago
|
Comment 2•6 years ago
|
||
Hmm, well, is this in any spec?
Assignee | ||
Comment 3•6 years ago
|
||
It's in the CSS Text 4 draft:
https://drafts.csswg.org/css-text-4/#hyphenate-char-limits
Comment 4•3 years ago
|
||
Hi do we have any news? Will this property be implemented soon?
kind regards
Assignee | ||
Comment 5•3 years ago
|
||
Assignee | ||
Comment 6•3 years ago
|
||
I took a stab at the CSS side of this (currently not hooked up to any actual layout behavior); WIP patch is above. Currently this seems to mostly work, but fails the transitions test at layout/style/test/test_transitions_per_property.html, so it's not 100% complete.
Agreed. I can't believe there is so little innovation in the area of hyphenation.
Updated•2 years ago
|
Comment 9•2 years ago
|
||
Hey Jonathan, an Intent to Ship for hyphenate-limit-chars was just sent to blink-dev[1]. I assume this is something that you'll eventually get back to, but let us know if this was paused due to other concerns. Thanks!
(Also let me know if you would prefer us filing a formal position issue - seems unneeded in this case)
[1] https://groups.google.com/a/chromium.org/g/blink-dev/c/TjuGJ-8TeXk/m/X8gUvSejAwAJ
Assignee | ||
Comment 10•2 years ago
|
||
Yes, I hope to get back to it at some point, but it hasn't been a top priority; not sure when I'll find some spare cycles.
Comment 11•3 months ago
|
||
Bump. =)
Implementing this would make life a lot easier for many web editors and designers around the globe.
Comment 12•3 months ago
|
||
I'm using this definitions since years in hope that this feature some day will be implemented.
Hope this will be implemented in the future because the default hyphens: auto handling looks so terrible...
-webkit-hyphenate-limit-before: 4;
-webkit-hyphenate-limit-after: 5;
-ms-hyphenate-limit-chars: 10 4 5;
hyphenate-limit-chars: 10 4 5;
Comment 13•2 months ago
|
||
It's good that Edge and Chrome do support this, but at Firefox and Safari I have to exclude the support of hyphenation because the text layout without hyphenate-limit-chars is so disturbing and hard to read, that using hyphenation at all doesn't make sense.
Updated•1 month ago
|
Assignee | ||
Comment 14•1 month ago
|
||
Assignee | ||
Comment 15•1 month ago
|
||
Assignee | ||
Comment 16•1 month ago
|
||
The spec[1] explicitly says that the computed value is "three values,
each either the auto keyword or an integer", so we expect the computed
value to consistently return all three values, even if only one or two
were specified.
Conversely, when serializing the specified value there is no requirement
to return all three possible values, if the trailing ones have their
default values. The serialization rules in the CSSOM spec[2] say:
If component values can be omitted or replaced with a shorter
representation without changing the meaning of the value,
omit/replace them.
This is applicable to a case like hyphenate-limit-chars: auto auto auto
.
[1] tells us that:
If the third value is missing, it is the same as the second.
If the second value is missing, then it is auto.
Therefore hyphenate-limit-chars: auto
is the correct serialization;
the omitted second value will be considered auto
, and the omitted
third value will be the same as the second, i.e. also auto
.
[1] https://drafts.csswg.org/css-text-4/#hyphenate-char-limits
[2] https://www.w3.org/TR/cssom-1/#serializing-css-values
Assignee | ||
Comment 17•1 month ago
|
||
Assignee | ||
Comment 18•1 month ago
|
||
Updated•1 month ago
|
Comment 19•24 days ago
|
||
Comment 21•24 days ago
|
||
Comment 22•24 days ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/b0d3a445cbb7
https://hg.mozilla.org/mozilla-central/rev/24a7788aaa86
https://hg.mozilla.org/mozilla-central/rev/0d2f510b48cd
https://hg.mozilla.org/mozilla-central/rev/077f492c6eb5
https://hg.mozilla.org/mozilla-central/rev/938bbe1ece4e
https://hg.mozilla.org/mozilla-central/rev/a84e9b2644d1
https://hg.mozilla.org/mozilla-central/rev/a4aa1d64b768
https://hg.mozilla.org/mozilla-central/rev/351da7476c93
Comment 24•23 days ago
|
||
:jfkthame could you consider nominating this for a release note? (Process info)
Comment 25•23 days ago
|
||
(In reply to Donal Meehan [:dmeehan] from comment #24)
:jfkthame could you consider nominating this for a release note? (Process info)
Note that this is currently off-by-default for releases beyond Nightly...
https://searchfox.org/mozilla-central/rev/548b6981501f59e3c9f2f7851c013e7d53c4e72f/modules/libpref/init/StaticPrefList.yaml#9607-9611
...but it looks like the relnote "process info" that Donal linked would still suggest a release note, to spread word among Nightly users who read the release notes and maybe get us a bit more intentional testing from web developers on Nightly as a result.
Comment 26•22 days ago
|
||
(In reply to Daniel Holbert [:dholbert] from comment #25)
to spread word among Nightly users who read the release notes and maybe get us a bit more intentional testing from web developers on Nightly as a result.
Correct, we can still include release notes for nightly-only features. Relman ensures the release note does not ride the train to the beta release notes.
Assignee | ||
Comment 27•22 days ago
|
||
Release Note Request (optional, but appreciated)
[Why is this notable]:
Automatic hyphenation (CSS hyphens: auto
) can be undesirable because it introduces too much hyphenation. This property allows authors who enable hyphenation to have better control over how frequently it is applied.
[Suggested wording]:
The hyphenate-limit-chars
property enables authors to have greater control over the use of automatic hyphenation.
https://drafts.csswg.org/css-text-4/#hyphenate-char-limits
Some background articles/blog posts:
https://medium.com/clear-left-thinking/all-you-need-to-know-about-hyphenation-in-css-2baee2d89179#8434
https://justmarkup.com/articles/2019-01-28-a-look-at-css-hyphenation-in-2019/#too-much-hyphenation
https://generatedcontent.org/post/44751461516/finer-grained-control-of-hyphenation-with-css4
Comment 28•22 days ago
|
||
Thanks, added to the Fx136 nightly release notes, please allow 30 minutes for the site to update.
Description
•