Closed Bug 1550532 Opened 5 years ago Closed 5 years ago

Suppress auto-hyphenation for Capitalized words [was: Don’t hyphenate proper nouns in English]

Categories

(Core :: Layout: Text and Fonts, defect, P3)

66 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: ragdoll, Assigned: jfkthame)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:66.0) Gecko/20100101 Firefox/66.0

Steps to reproduce:

Used hyphens: auto on p elements.

Actual results:

Hyphenation was turned on, but there is far too much hyphenation. In particular, proper nouns, i.e. names, get hyphenated. Some names, like Justin and Stephanie appear to not be hyphenated, but Prudence doesn’t like it when her name reads as

>                     Pru-
> dence

Likewise, companies don’t like it when their names that happen to use common words are broken across lines.

The only options to address the issue on the developer side are to either code in spans that turn hyphenation off on a word-by-word basis, which is too much to ask when content is distributed among non-technical workers in a large site, or to turn off hyphenation altogether, which is always the result, because it’s the path of least resistance.

Expected results:

Proper nouns in English should never be hyphenated. If, for some reason, they do need to be hyphenated, that should be the edge case, not the other way around.

Hyphen support is uniformly bad across all browsers, but they should be progressive enhancements. As it stands, turning on hyphens degrades the quality of the content and hyphenating proper nouns is the primary reason for that.

Component: Untriaged → Layout: Text and Fonts
OS: Unspecified → All
Product: Firefox → Core
Hardware: Unspecified → All

In general, it would be good to have more sophisticated control of hyphenation. (CSS Text 4 introduces some additional properties[1] to provide more control, but is a long way from being implemented at this point.)

Perhaps we should consider excluding capitalized words from auto-hyphenation for the time being. I suspect that would be an improvement in more cases than not.

[1] https://drafts.csswg.org/css-text-4/#hyphenation

Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Summary: Don’t hyphenate proper nouns in English → Suppress auto-hyphenation for Capitalized words [was: Don’t hyphenate proper nouns in English]

If we do this, it'll have to be lang-specific, I think; we wouldn't want to suppress hyphenation of capitalized words in German, for example, or all its Wonderfullylongcompoundnouns will become unhyphenatable.

This affects a number of our existing reftests, so we'll need to update those
to not expect hyphenation of a sentence-initial (capitalized) word.

(Hyphenation behavior is not sufficiently well-specified for this to be tested
at the WPT level, so we just use Gecko-specific reftests.)

Attachment #9064453 - Attachment description: Bug 1550532 - Avoid hyphenating capitalized words, except for German. r=emilio → Bug 1550532 - Avoid auto-hyphenating capitalized words, except for German. r=emilio
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a811c910cfd3
Avoid auto-hyphenating capitalized words, except for German. r=emilio,mats
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Assignee: nobody → jfkthame
Depends on: 1557291
Regressions: 1575513

This change has broken hyphenation in a significant number of languages other than English.
Rather than making an exception for German, please restrict this change to English only, since there seems to be a majority of languages that do want hyphenation of capitalized words.

Also, this change has also caused the first word in a sentence to not be hyphenated. You actually seem to have discovered this from tests failing and still pushed through this change. Frankly, I am astonished to see that nobody stopped to think that maybe that should be fixed.

These two issues have in combination caused a significant regression in page layout for a number of languages, particularly on mobile. With mobile traffic now making up a majority, this is only more serious. On mobile, languages like Danish, German or Finnish (among others) have a need to hyphenate their frequently longer words, capitalized or not.

Wow, this is terrible! This effectively disables auto hyphenation in the one case it really matters: titles. Titles always start with a capital letter; and since in Norwegian lots of titles can be one single compound word; you are forcing us to either always manually insert ­ characters in all titles to not get overflow on mobile; or use break-word to mangle the title by breaking it anywhere without hypens even though if only we incorrectly wrote the word with lowercase it would be able to hyphenate it perfectly.
At least make a css option to ignore the stupid uppercase rule!

In any case; isn't it always more desirable (even in English) to hyphenate a word than to have it overflow? I would think that companies would much rather prefer to have their name hyphenated and still visible than to have half of it disappear off the page (or to have it randomly chopped to fit using word-break: break-all;)

At least make an exception to this rule if the word in question doesnt fit on the line at all without hyphenation. (And better yet, do not apply to every language in the world a fix a perceived issue only in English)

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: