Re: [css-text-decor] not underlining trailing spaces

> On 09 Mar 2015, at 17:45, Florian Rivoal <florian@rivoal.net> wrote:
> 
> If you have "text-decoration: underline;" and "white-space: pre-wrap;" (or pre)
> all the (non collapsed) white space is underlined, including the spaces at the end of the line that are followed by a break/wrap point.
> 
> http://jsbin.com/bedefu/1/watch?html,css,output
> 
> That is what I'd expect based on the spec, but it may not be the ideal behavior in all cases. For instance, word processors / rich text editors don't do this, and if you're making a web based rich text editor using contenteditable and the like, you would want to match.
> 
> MS Word, LibreOffice, Apple Page or Apple TextEdit all do the same in this case: underline the spaces between the words, but not those at the end of the line.
> 
> We should probably not try to change the default behavior, given that:
> - We have interop on the current behavior
> - In other contexts, the current behavior may actually be what you want (for example, underlines caused by syntax highlighting in vim matches what we currently do).
> 
> However, I do think this would be worth supporting. Adding "trailing-spaces" as a new value to the text-decoration-skip would be ideal for this.

We've resolved to do this, so here's a pull request to make it happen:

https://github.com/w3c/csswg-drafts/pull/13

Since specifying trailing-spaces together with spaces doesn't do anything different from just adding spaces, I've added the new value as:

text-decoration-skip: none | [ objects || [ spaces | trailing-spaces ] || ink || edges || box-decoration ]

rather than

text-decoration-skip: none | [ objects || spaces || trailing-spaces || ink || edges || box-decoration ]


Also, should we consider making the initial value ''objects trailing-spaces'' rather than just ''objects''? Or maybe ''auto'' which let's UAs pick between the two depending on what they doing with properties like 'white-space', 'word-wrap', etc?

 - Florian

Received on Thursday, 12 March 2015 13:36:05 UTC