W3C home > Mailing lists > Public > public-css-archive@w3.org > December 2020

[csswg-drafts] [css-pseudo-4] Fine-tuning ::first-letter punctuation pattern matching (#5830)

From: fantasai via GitHub <sysbot+gh@w3.org>
Date: Thu, 31 Dec 2020 03:37:03 +0000
To: public-css-archive@w3.org
Message-ID: <issues.opened-776747145-1609385822-sysbot+gh@w3.org>
fantasai has just created a new issue for https://github.com/w3c/csswg-drafts:

== [css-pseudo-4] Fine-tuning ::first-letter punctuation pattern matching ==
In https://github.com/w3c/csswg-drafts/issues/5154 we updated the spec to include "intervening" white space. Certainly for spaces before the first letter this is correct, but the example of “`A "b"` will have `A "` selected” in @csnardi’s https://github.com/w3c/csswg-drafts/issues/2164#issuecomment-359817376 shows a real problem with this approach: since we reach out to following punctuation, allowing intervening white space *after* the first letter means we'll jump a word space and scoop up opening punctuation on the other side. :( I think we definitely need to make this smarter.

A few rules we could adopt that could help:
- Break on normal word spaces and nbsp, at least on the following side of the first letter. If people want to scoop up subsequent punctuation after a space, they'll have to use typographically correct space codepoints such as thinsp.
- Exclude opening punctuation following the first letter. In writing systems without a word space, we shouldn't be picking up the opening parens after the first "letter"! Po/Pi/Pf are ambiguous, but Ps is not.
- If there's an element boundary *after* the first letter, require that the UA close ::first-letter before that boundary, excluding the content after that element boundary, rather than allowing them to create ::first-letter after (excluding the first letter itself!) or both before and after the element boundary as we do currently.

I think we also need to do some more thinking about following Po/Pi/Pf/Pd.

Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/5830 using your GitHub account

Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Thursday, 31 December 2020 03:37:05 UTC

This archive was generated by hypermail 2.4.0 : Tuesday, 5 July 2022 06:42:24 UTC