Re: [csswg-drafts] [css-text] Prevent line breaking after explicit hyphens (#3434)

The existing hyphens property seems to be implemented by browsers as specifying how to handle _adding breaking hyphens_ to the rendered text in places where there are not explicit hyphens in the source text itself.

It seems like a new value for this existing single-value property to specify how to handle line breaks around _hyphens explicitly in the source text itself_ would not be a good solution.

Instead, perhaps the hyphens property could be turned into a shorthand for new hyphens-auto and hyphens-explicit properties, or similar. The hyphens shorthand order could then be set as `hyphens: {hyphens-auto value} {hyphens-explicit value};`, with the hyphens-explicit value being optional, to allow for backwards compatibility of existing uses of the hyphens property.

This would also allow for a set of values for the hyphens-explicit property distinct from the behavior of hyphens-auto. These values for hyphens-explicit could be something like:
- `wrap` for the current norm of allowing a wrap directly after any explicit hyphen.
- `nowrap` for preventing any breaks at explicit hyphens at all.
- `limited` for preventing breaks at explicit hyphens up to a certain character length limit, but above that character length limit allowing breaks. Perhaps the character length limit could also be set via another property like hyphens-explicit-limit, or similar.

Also, I would like to see it explicitly clarified in the specs how these properties do or do not apply (for Latin scripts) to hyphen-minus (U+002D), soft hyphen (U+00AD), hyphen (U+2010), non-breaking hyphen (U+2011), en dash (U+2013), and em dash (U+2014).

-- 
GitHub Notification of comment by Gregory-Potter
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3434#issuecomment-2874925039 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 13 May 2025 03:02:16 UTC