-
Notifications
You must be signed in to change notification settings - Fork 671
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
[css-pseudo-4] ::first-letter should include space separators #5154
Comments
See #2040 for suggested |
The following example can be used to test how different browsers renders the ::first-letter pseudo element: |
This 10 year old bugzilla issue describes the same thing: |
Current spec prose for reference:
I believe the pattern we want to collect is:
Agenda+ to confirm. |
If that was supposed to be regular-expression-ish, I'd have expected the equivalent of the prose to be something more like (with slightly different notation) |
(I think your grammar also needs to indicate that this appears at the beginning of the paragraph.) |
@r12a The grammar isn't going into the spec, and the spec already anchors it to the first Letter/Number. |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: [css-pseudo-4] ::first-letter should include space separators<dael> github: https://github.com//issues/5154 <dael> fantasai: Issue about how not including spaces but only punct. <dael> fantasai: NUmber of punct related patterns with punct space letter. <fantasai> https://github.com//issues/5154#issuecomment-655940861 <dael> fantasai: Prop is update as desc ^ to include intervening whitespace in ::first-letter <dael> Rossen_: Feedback or objections? <Rossen_> q? <Rossen_> ack chris <dael> faceless2_: If not followed by letter does that go with it? <dael> fantasai: Currently ::first-letter is a letter or digit. If you have paragraph with only punct there is no ::first-letter <dael> tantek: I accept the situation exists in prose. What I'm not seeing in issue is documentation or example like print example of ::first-letter with punct and space and letter all as first letter <dael> tantek: Open to keeping issue open but needs more data to accept b/c otherwise might make worse <dael> tantek: Inclusion of punct in ::first-letter at all we had numerious examples in multi lang. Since I'm not seeing that I would reject <dael> fantasai: Do you have those examples? <dael> tantek: Yeah, need to check my bookshelf <dael> fantasai: Typical case if if " in french you have to include space. Usually not full sized. <dael> tantek: My point is a french first letter with a " and a letter. Need to see that example to move forward. <astearns> there are two references in the initial comment <fantasai> https://bugs.chromium.org/p/chromium/issues/detail?id=638267 <dael> myIes: I think I disagree with tantek. If we're doing ::first-letter that punch through pucnt this has to happen if we support french <dael> florian: Question is valid, does french do that <dael> fantasai: This raised b/c issue filed against browsers and browsers wanted spec update <dael> Rossen_: And there are bugs linked in issue <dael> tantek: At time we found print examples in magizines so it was not hard to find. If that's not true in french I'd push back. Someone more familiar with french I'd ask have they ever seen it in french and share an example rather then rely on theory <dael> Rossen_: French only? <dael> tantek: I think Norwegian is also provided in issue <dael> tantek: Either is sufficent evidence. <dael> tantek: When talking details I'd rather based on examples and not completionism reasoning. <dael> dauwhe: We use spacing like this all the time " and than ' would be sep by a space. If that's all ::first-letter we'd want it all selected. We use spaces between punct all the time. <dael> tantek: That's different than prop. <dael> fantasai: That's included. All punct before first letter is included as well as any intervening space. So this would solve dauwhe use case <dael> tantek: Have you seen it in print? <dael> fantasai: We have it in English <dael> dauwhe: I can't remember if I've seen that at start of chapter with initial-letter. Somewhere that I'd need a ::first-letter selector to capture that combo of glyphs <dael> tantek: Anything adding complexity to platform has a cost. It's reasonable to request some examples produces, esp with other lang <dael> astearns: True there is a cost, but this is a case w/o interop. We can spec what is requested and have engines that don't do it match those that do and we gain interop <dael> Rossen_: And this is Mozilla right that would need to add to be interop <dael> tantek: I couldn't determine from issue which engines did what <dael> astearns: We know some do and some don't. Seems reasonable to spec this knowing there are strings that have this behavior and people like to apply ::first-letter to things. I don't know it's nec to come up with print example to spec this and have engines match <dael> Rossen_: I think 2nd paragraph in opening issue comment. Safari incl spaces, Chrome doesn't. 10y/o bug from Mozilla desc this. <dael> Rossen_: Safari is ahead and Moz and Blink need to catch up <dael> Rossen_: There is precent for interop <dael> plinss: If there isn't inerop there is fail in testing or unclarity in spec. Need to fix either way <dael> tantek: I'd worry about compat if there's a 10 y/o bug <dael> fantasai: Safari shipped with this. Not sure why worried about compat <dael> tantek: Safari might have compat problem <dael> fantasai: Doubt it <dael> florian: Esp since people filing bugs against Chrome and FF <dael> fantasai: We've spent a long time on this. I'd rather we not spend more time. tantek will you block and want us to go look for more b/c the lack of interop and old bugs is not enough? <Rossen_> q? <dael> tantek: Prefer to request examples and leave open <dael> florian: We're trying to align so I don't object <dael> Rossen_: Sounds like tantek you object on resolving based on lack of evidence. <dael> Rossen_: Let's record that objection. It will go into the issue. <dael> Rossen_: I'm hoping dauwhe or Richard can get an example and we can resolve next week. <dael> Rossen_: Either way we'll come back to discuss this around interop. <florian> s/We're trying to align so I don't object/I would agree with tantek if there had been interop and we were proposing to change, but there isn't interop and we're trying to align, so I don't agree/ <tantek> That's fine, didn't intend so much time on this issue <dael> Rossen_: tantek do you agree with this? <dael> tantek: Yes, reasonable. Thank you |
@johannesodland So Tantek insists on seeing real-world examples where this behavior is necessary, since he doesn't believe the change is worth making to the spec otherwise. Do you happen to have any examples of existing typography showing the desired behavior? |
I think another important aspect is, are there use cases/examples for not including spaces in the first letter? e.g. is there existing content where someone deliberately put a space after punctuation so that the following letter was not considered to be in the ::first-letter. In english at least, I can't come up with a valid use case where this would be desirable, where I can come up with use cases where the space should be included. If there are valid use cases in both directions, then perhaps we need an additional control to determine what's included in ::first-letter. |
I'll look around for some examples. Perhaps i can rope in some help from folks in France, but Florian may also know where to look. One thing to consider: the space between punctuation and text in French is commonly not an ordinary space, but rather a NNBSP or other such thinner spaces. We might, just a thought off the top of my head, want to consider whether only these types of space trigger the text to be kept together – which would probably address the concern of @plinss for false positives, if that turns out to be a significant concern, but we'd also need to ensure that those spaces are captured in any rules. Wrt current behaviour, i have some results and a link to a test that cover the 3 main engines and 3 types of space, at w3c/line_paragraph_tests#54. |
Just to be sure... http://wpt.live/css/css-backgrounds/first-letter-space-not-selected.html its reference In my opinion, the test above is correct. ::first-letter applying to PunctuationCharacter+Space+LetterOrNumber is different and can make sense (depending on language). According to Unicode, there are many kinds of spaces (gc = Zs) and many kinds of punctuation characters which would eventually apply regarding this issue: Code Name Pc Connector_Punctuation a connecting punctuation mark, like a tie |
FWIW, here are some examples of first letter styling in French: References:
(We should document this in https://www.w3.org/TR/dpub-latinreq/#initial-capitals ) |
Of those three examples ("— « M", "«L'", and "«E"), only the second one (the L) seems doable with |
Typografi.org has an example of the norwegian remark punctuation ("replikkstrek"). It can be seen in the following sentence: – Bare vent litt, jeg må fange en squirtle her. The author notes that the preferred option is to style the punctuation away. To be able target punctuation for styling we also need the |
I'll write a few words about why I brought up this issue. I work in the norwegian public broadcasting company. We've tried to use the In an article we published in 2017 we deliberately changed the language and dropped starting sections with these sentences to avoid this problem: https://www.nrk.no/sperret-inne_-slatt-og-lenket-fast-1.13769828 Typography literature tells us to hide the punctuation, or move it into the margins (hanging punctuation). Most examples I can find in todays print newspapers hide the punctuation. (typography teaching book from 1952: https://www.nb.no/nbsok/nb/a627d2b30ca616ba40bcd2100bf63e1f?index=3#59) On the web we can not simply remove the punctuation. We need to support older browsers and progressively enhance the layout. The punctuation can be hidden only when Including space separators in I fear that if |
The CSS Working Group just discussed The full IRC log of that discussion<dael> Topic: [css-pseudo-4] ::first-letter should include space separators<dael> github: https://github.com//issues/5154 <dael> astearns: Last week asked for examples. They were. <dael> astearns: One concern from plinss that there may be case of languages where people add space to make sure punct doesn't get added w/ first letter <dael> astearns: I think I have seen examples of this with block quote and just " is the first-letter. Probably added a space to make sure first letter isn't ::first-letter styled <dael> astearns: I think plinss is correct we can't make this change and need a toggle to opt in <dael> astearns: Any disagreements? <dael> plinss: I think that behavior is not the norm. Maybe we enable and toggle is to opt-out <dael> astearns: Certainly possible. Could enable, not worry about toggle until we get bug reports when browsers change <dael> astearns: We left with tantek wanting examples. Unfortunately he has a conflict today <dael> plinss: Part of why I brought that up was to push back on tantek wanting examples. I was partly bringing up for a requirement to add counter examples <dael> astearns: Sounds like you're in favor of the change <dael> plinss: Yes but I think tantek should be heard <dael> astearns: Other comments? I'm guessing we should push to next week when tantek is available <tantek> If we already have compat between Gecko and Blink *not* including the space then you've got a compat issue potentially too <dael> astearns: Okay, we will do that. <tantek> so I'll push back until someone provides a print example showing a real world need |
@dbaron Wrt #5154 (comment) this distinction appears in languages (like English) that don't use spaces between the quote mark and the drop-cap, and is an issue against |
The CSS Working Group just discussed
The full IRC log of that discussion<TabAtkins> Topic: Should ::first-letter include space separator?<Rossen_> github:https://github.com//issues/5154 <TabAtkins> astearns: We got the examples tantek was asking for <TabAtkins> astearns: For Norwegian and the other language [French, I think], it makes sense to add those space separators, since they're in the markup <TabAtkins> astearns: A little afraid of turning it on for other langs, becuase if you have an open-quote and capital letter, and all you want is the quote itself, maybe people are adding spaces to create the separation currently? <TabAtkins> florian: I think dauwhe said they were inserting spaces to adjust visual separation for English content, so they would want the space included. <TabAtkins> tantek: I tried to do a little more research as well. <TabAtkins> tantek: Didn't have time to upload <TabAtkins> [shows Elements of Typographic STyle] <TabAtkins> tantek: ON p64, there's some first-letter effects with leading punct, including with guillarmes <TabAtkins> tantek: So the point I'm making here is that it's not the entire thing is the first letter, it's that the punctuation is skipped over, only the letter is embiggened, then the punct is situated next to it. <TabAtkins> tantek: So I'm concerned we might be doing the wrong thing. <TabAtkins> astearns: There's a separate issue addressing that layout, and the current suggestion to get that addressed requires the punct to be part of the ::first-letter <AmeliaBR> q+ <TabAtkins> tantek: Ok [shows an example in English too]. Maybe we should consider these issues together. <fantasai> It's issue 2040 <TabAtkins> astearns: I'll drop it in the minutes. <Rossen_> ack fantasai <TabAtkins> fantasai: So this is about whether we include the space *when* there is a quotation mark, not about the quotation mark itself. <TabAtkins> fantasai: If we want French and English to be the same, we need to include it. <astearns> there is also https://github.com//issues/4988 for changing size of components of initial-letter <TabAtkins> fantasai: As astearns said, 2040 is about the formatting question if you want the punct and letter different. <tantek> q? <TabAtkins> fantasai: Richard said we didn't need to include U+0020 space, becuase the spaces used here are typically other spaces, not the standard word separator. <florian> q+ to comment on U+0020 <TabAtkins> fantasai: So if we're really concerned, we cna exclude u+0020 and only include the other spaces. <TabAtkins> fantasai: And note that the punct by itself wont' be picked up as a ::first-letter anyway; you need a letter. <TabAtkins> AmeliaBR: I'm not sure about ignoring u+0020, lots of people will type this with a stadnard space <Rossen_> ack AmeliaBR <TabAtkins> AmeliaBR: But probably the more exotic spaces can be ignored. <TabAtkins> AmeliaBR: The one common thing from tantek's examples, and some in the issue, where the initial punct is different than the letter, they all have the letter as big. So to do that, we at least need the characters up to the letter to be included. <chris_> rrsagent, here <RRSAgent> See https://www.w3.org/2020/07/31-css-irc#T14-17-39 <fantasai> Anyone who's fussy about typography will use the correct space, I think :) <TabAtkins> AmeliaBR: If we dont' come up with a special solution for people who want the punct to be offset or smaller, there's always the option of people including spans to mark off certain characters. <Rossen_> ack florian <Zakim> florian, you wanted to comment on U+0020 <tantek> if I paste this here does it work? https://github.com//issues/2040 <TabAtkins> florian: Good guides about typography will say to use various spaces, but most people dont' know how to type those. <astearns> I think we should allow the regular space, even though I'm fussy about typography <TabAtkins> florian: At least in French, it's pretty common to say ordinary spaces, probably same in Norwegian. So I'd include standard space. <Rossen_> q? <TabAtkins> tantek: My concern is that if we just flip this on, we'll cause pages that have not been tested with this to suddenly have first-letters that didn't before. <TabAtkins> tantek: And end up with big punctuation as well as big letters. <TabAtkins> tantek: That might come as a surprise to authors who are used to not doing that automatically. <TabAtkins> tantek: And I'm not sure it's the right default. <TabAtkins> tantek: So if it is punct-space-letter, maybe the letter itself should be the only thing included as the ::first-letter, and the pucnt gets normal inline styling. <TabAtkins> tantek: That would look closer tothe typography examples. <florian> q+ <TabAtkins> tantek: I'm concerned we have yet another place where we do the wrong thing typographically by default. <TabAtkins> tantek: The web has a tradition of this, liek the way large text messes up the line rhythm. <chris_> so now we need a term for "the characters before the first actual letter"? <TabAtkins> tantek: So I'm concerned if we add one more papercut. <fantasai> chris_, we need a pseudo-element, yes :) <TabAtkins> q+ <TabAtkins> tantek: 5154 shows what browsers are currently doing <TabAtkins> tantek: There's an example with th eleading quote... [missed] <Rossen_> ack fantasai <TabAtkins> fantasai: I think tantek is getting caught up in the not-perfect <astearns> in the examples provided for this issue, the punctuation *does* take the same styling as the letter: https://github.com//issues/5154#issuecomment-659129316 <chris_> ::first-letter-before <TabAtkins> fantasai: I think you're forgetting that English and French punct have the same problem and have to be treated the same way <Rossen_> ack florian <TabAtkins> fantasai: We need to include the space to keep these on-par, and having them be inconsistent is bad <TabAtkins> florian: Having ::firs-tletter select the letter and not the preceding punct seems bad, it's already complicated, sounds scary. <fantasai> s/bad/bad and doesn't solve those problems anyway/ <TabAtkins> florian: As to compat, Safari does it already. So there's some amount of content out there probably already depending on it. <florian> http://www.typografi.org/dropcaps/assets/sitatstrek-anf%C3%B8rselstegn_714.jpg <TabAtkins> florian: So in this example we actually do want the included thing to be large. <TabAtkins> florian: In other cases we wont' want the punct large, but those apply equally to the exisdting punct-letter without space. <fantasai> TabAtkins: Florian touched on it at the end, one of the big concerns Tantek brought up <fantasai> TabAtkins: is wanting to address differently-sized punctuation wrt first-letter <fantasai> TabAtkins: But that's already the case. If there's no space, we already have that problem, already have to solve it. <fantasai> TabAtkins: It's not relevant to this issue. <Rossen_> ack TabAtkins <TabAtkins> Rossen_: So I think there were several reasons for ahving this, including some existing shipping impls <TabAtkins> Rossen_: So it's probably not a compat risk, or at least not a big one. <tantek> q+ <Rossen_> ack tantek <TabAtkins> tantek: I don't actuallys ee the Safari example as proof of no compat problem <TabAtkins> tantek: Safari applies all th epunct as well. <TabAtkins> tantek: It wouldn't surprise me if there's special-casing going on here, looks like impl by accident. <TabAtkins> tantek: Looking at an example with a massive preceding dash. <TabAtkins> tantek: It woudlnt' surprise me if people are already not giving that styling to Safari to avoid that problem. <TabAtkins> astearns: Also in CHrome <AmeliaBR> Slight tangent, but while testing I discovered that browsers treat quotes in the markup different from quotes inserted via `::before { content: open-quote }`. Is that expected, or just part of all the bugs? <TabAtkins> tantek: Ok. So that's a bug, and I dont' thinkw e should be designing based on a bug. <Rossen_> q <TabAtkins> florian: We're not saying it's a bug, we're saying it's desirable. <TabAtkins> tantek: I'm talking justa bout the hyphen. <TabAtkins> tantek: Because of that I think authors might be picking different techniques. So maybe we dont' have a compat problem at all then, because nobody's using it. <TabAtkins> florian: If there is a real compat problem we'll find tou and revisit <TabAtkins> faceless2: The big hyphen was actually a desired effect <faceless2> http://www.typografi.org/dropcaps/assets/sitatstrek-anførselstegn_714.jpg <florian> s/tou/out/ <TabAtkins> tantek: I'm convinced by the examples, we shoudl do this, but we should make it dependent on solving 2040 <TabAtkins> tantek: That would be my compromise proposal <TabAtkins> tantek: I think this group can solve that. <TabAtkins> fantasai: We need to do one thing at a time. These are two separate features that happen to work together. <TabAtkins> fantasai: So let's just get opening quotes working the same between langs. <TabAtkins> tantek: They're both ::first-letter <TabAtkins> [back and forth] <Rossen_> q? <astearns> +1 to resolving on this now <fantasai> TabAtkins: Today, a single quote and no space, will be combined together. <fantasai> TabAtkins: and the quote won't be sized "correctly" in that case either. <TabAtkins> Rossen_: Okay, so it sounds like people are all okay with the proposal as it exists. Tantek, you had an objection based on no examples; we now have those. Do you still object? <TabAtkins> tantek: I strongly prefer that we make this resolution dependent on 2040, but I won't object. <TabAtkins> Rossen_: So any objections? <TabAtkins> RESOLVED: Spaces separating punct from first letter dont' stop ::first-letter |
We use a regular space between the punctuation and the first letter in norwegian:
There are several examples where the punctuation is styled with the same size as the letter. The author notes that it's preferable to hide the punctuation, as in the lower example. Sometimes the punctuation is styled smaller and placed into the margin. I think the best thing would be to support all three versions. This issue should be seen together with #2040 |
…g with the adjacent punctuation. #5154
@johannesodland Thanks for the ping. :) And also all of the great examples. Edits are in. I think the spec would benefit from a good example / illustrations. Do you think you could hack your examples in #5154 (comment) to look the way they ought to, and we can include them in the spec? |
@fantasai Sorry for answering this late. I didn't see the comment. I'm a little bit wary of adding the examples, because in the end one ought to adjust the style of the punctuation as well. This is tracked in #2040. I have created a test-case of the examples here: web-platform-tests/wpt#25828 |
I created a reference of the initial test-page here: |
Some languages requires a space separator between the first-punctuation and the first letter. Both the punctuation and the space separator should be included in the ::first-letter pseudo element.
Browsers treat this differently at the moment. Safari includes spaces, while Chrome does not.
https://bugs.chromium.org/p/chromium/issues/detail?id=638267.
At the moment the spec does not specify that space should be included: https://www.w3.org/TR/css-pseudo-4/#first-letter-pseudo
Examples:
French
The opening quotation mark in French cannot go without a space:
« Voulez-vous un sandwich, Henri ? »
Source: https://en.wikipedia.org/wiki/Quotation_mark#French
Norwegian
Some quotation marks in Norwegian (replikkstrek) cannot go without a space:
– Pettersen, ropte hun, – kom inn og få kaffe.
Source: https://www.sprakradet.no/sprakhjelp/Skriveregler/tegn/Tankestrek/
The text was updated successfully, but these errors were encountered: