Open Bug 2053872 Opened 21 days ago Updated 20 days ago

Firefox doesn't break strings of repeated hyphens, whereas other browsers do

Categories

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

defect

Tracking

()

People

(Reporter: dholbert, Unassigned)

References

(Blocks 2 open bugs)

Details

(Keywords: webcompat:platform-bug)

User Story

user-impact-score:120

STR:

  1. Load this testcase (3 hyphens in a 0-width div):
data:text/html,<!DOCTYPE html><div style="font:50px monospace; width:0px">---

FIREFOX RESULTS:
Hyphens all lay out on a single line.

CHROME/SAFARI RESULTS:
The hyphens linebreak - each gets its own line.

I'm testing these browser versions:
Firefox 152.0.5
Chrome 151.0.7922.19 (Official Build) beta (x86_64)
Safari 27.0

jfkthame, do you know there's a good reason for us to decline-to-linebreak here?

(This is behind bug 2047514 where a site has a long string of hyphens serving as a horizontal line in the middle of some explanatory text. Firefox declines to linewrap the hypyhens, so they cause overflow and cause some content to end up off-screen.)

See Also: → 1322115

Well.....it's one of those "hard call" issues where no simple rule will satisfy all use cases/situations.

When someone types --- to stand in for an em-dash, for example, they probably wouldn't be too happy if we line-break in the middle of it.

data:text/html,<!DOCTYPE html><div style="font:50px monospace; width:12ch">hyphen runs--are they breakable?

Our behavior seems to follow from rule LB21 in UAX#14, fwiw. Makoto-san would be more familiar with the details here, I expect.

(At least we try to be consistent! In Chrome, try comparing

data:text/html;charset=utf-8,<!DOCTYPE html><div style="font:50px monospace; width:0px">--a--

and

data:text/html;charset=utf-8,<!DOCTYPE html><div style="font:50px monospace; width:0px">--á--

to see a weird discrepancy in hyphen behavior depending on the letter used.)

Summary: Firefox doesn't break strings of hyphens, whereas other browsers do → Firefox doesn't break strings of repeated hyphens, whereas other browsers do
User Story: (updated)
You need to log in before you can comment on or make changes to this bug.