-
Notifications
You must be signed in to change notification settings - Fork 715
[css-text] Prevent line break after hyphen preceded by space #3463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have this problem all the time with The only reason to add CSS control would be if there was a situation where you would want the line to leave an initial hyphen hanging on its own. |
Related to the discussion in #3434 (comment) |
https://www.w3.org/TR/css-text-3/#line-break-details
|
Agree with @AmeliaBR that this is a quality-of-implementation issue. I think the spec clearly expects the behavior you're expecting; but we could maybe benefit from a testcase. |
Committed 4789b41 to clarify that
I think that should help with drawing up tests here. Marking Agenda+ for review as we are in Last Call. Otherwise I think this issue is closed, spec-wise. |
The CSS Working Group just discussed
The full IRC log of that discussion<dael> Topic: Prevent line break after hyphen preceded by space<dael> github: https://github.com//issues/3463#issuecomment-450522790 <dael> fantasai: This is [space]-foo and don't break before hyphen <dael> fantasai: I added clarifications because there were points missing. Prioritization shoudl apply to all word separators. Second was clarify prioritization isn't expected for word-break:break-all <dael> fantasai: Added you're allowed to consider a bunch of factors, there's no limit but have a list of things you should consider. Added a note that says prioritization forbidden when there's line-break:anywhere. That's already stated in line-break:anywhere <dael> fantasai: Wanted to check WG is okay with changes <dael> florian: Okay with changes, not sure they solve issue. I suppose hyphen is punct. but it seems worth mentioning explicitly. Even if you don't break around a / we do at hyphen <dael> fantasai: Have same problem with /. Have same with ". <dael> florian: Do people allow break around / and "? <dael> fantasai: Some allow break after a /. This is why it says SHOULD <dael> fantasai: I don't think we can define all exceptions we want people to follow. There's a lot of information in different sources. We can't dictate everything <dael> astearns: Given issue was opened on hyphen it would be nice to have an example of a break to avoid with a hyphen to go along with break to avoid after a / <dael> fantasai: Can add an example <dael> myles_: These subjective choices should be made in a lang and local specific way <dael> fantasai: Right <dael> astearns: True and section does mention writing systems <dael> florian: You said people break around /. FF doesn't. I tihnk that's what makes hyphen different. People do wrap after hyphen <dael> fantasai: Sometimes it's appropriate <dael> florian: Is when hyphen starts word <dael> fantasai: space hyphen Chinese character, do we forbid that? I can't define every rule for every system <dael> dauwhe: My company has people who spend their day worrying about these things and it's highly contextual <dael> myles_: I'm happy with should <dael> astearns: I'm falling against additional examples b/c we can't go through all bits of context to consider <dael> astearns: Other comments on these changes? <dael> astearns: Objections to accept these changes for text L3? <dael> RESOLVED: accept these changes for text L3 |
Chromium issue: https://crbug.com/974470 |
This is marked as WontFix. Is this an issue with Unicode? |
@valtlai Maybe but not necessarily. Chrome can fix this if they want to, with the specs as they are today. The specs aren't precise enough to require that behavior, but they allow it, and this kind of refinement is expected from good quality implementations. If Chrome wants to fix this case only if the Unicode spec requires them to, then asking Unicode to change is a possible path forward. Convincing Chrome that they should change with the specs as they are is another one. No strong opinion as to which is more likely to be successful. |
I want to prevent a line break after a hyphen that is preceded by a space.
So a string like
can be broken as
but not
I’m not sure if this can be solved by CSS spec (e.g., a new keyword for
hyphens
oroverflow-wrap
, etc.) or if it’s a browser bug: Firefox does like described by default, Chrome doesn’t.(Demo: https://codepen.io/valtlai/pen/WLRjeo/left/?editors=1100)
Another example
String:
Allowed:
Disallowed:
The text was updated successfully, but these errors were encountered: