Open Bug 1883494 Opened 1 year ago Updated 9 months ago

Firefox does not line-break/wrap between dashes, Chrome and Safari do

Categories

(Core :: Internationalization, defect)

defect

Tracking

()

Webcompat Priority P2

People

(Reporter: twisniewski, Unassigned)

References

(Blocks 1 open bug, )

Details

For instance, try this data URL:

data:text/html,<p style="width:20em">-----------------------------------------------------------------------------------------------------------------------------

Chrome and Safari line-break and wrap the string of dashes, but Firefox does not. This is causing text to wrap over other text between flex-based columns on https://firebook.store/books, as reported on https://webcompat.com/issues/133858.

This bug is not related to recent shipped ICU4X segmenter in bug 1854032. Firefox has always disallowed line breaks between dashes, so does UAX 14 standard. If we have a solution for bug 1848049, we might want to fix this at the same time.

Chrome uses customized table for ASCII line breaking. They allow breaks between dashes. (Look for '-' in the column)
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/text/text_break_iterator.cc;l=124,137;drc=c31cada822ed35cd471b44b01fde91b1684075a3

Webkit has something similar.
https://searchfox.org/wubkat/rev/e39148d92100300d5dc67cc72fe8f66da1d3cc6b/Source/WebCore/rendering/BreakLines.cpp#54,67

Severity: -- → S3
Component: Layout: Text and Fonts → Internationalization
See Also: → 1848049
Summary: Firefox does not line-break/wrap between dashes, Chrome and Safari do.For → Firefox does not line-break/wrap between dashes, Chrome and Safari do
Duplicate of this bug: 1347808
See Also: 1347808

Carry webcompat flag from bug 1347808.

Webcompat Priority: --- → P2

Quoting one important note from the older version of this bug, bug 1347808 comment 8:

(In reply to Jonathan Kew [:jfkthame] from comment #8)

Example where Chrome's behavior of treating every hyphen as a break
opportunity gives poorer results:

data:text/html,<div style="font-family:monospace;width:28ch;">double hyphens may be used -- like this -- to stand in for em-dashes

Firefox keeps the hyphens together.

(jfkthame posted this 7 years ago, but it remains true today. Chrome splits the first "--" there, between the hyphens. Firefox keeps the hyphens together.)

The issue is still reproducible.

Tested on:
• Browser / Version: Firefox Nightly 128.0a1 (2024-05-30) / Firefox Release 126 / Chrome 125.0.6422.113
• Operating System: Mac OS Sonoma 14.1.3

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