4

Github [css-pseudo-4] need for clarification on how ::selection text-shadows wor...

 2 years ago
source link: https://github.com/w3c/csswg-drafts/issues/3932
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Collaborator

TalbotG commented on Jul 17, 2019

edited

6 tests on text-shadow and ::selection

5 of them are manual tests.

The CSS Working Group just discussed need for clarification on how ::selection text-shadows work, and agreed to the following:

  • RESOLVED: If multiple layers with text-shadows we draw them all
  • RESOLVED: Background on a highlight layer paints over shadows on layers below
The full IRC log of that discussion <dael> Topic: need for clarification on how ::selection text-shadows work
<dael> github: https://github.com//issues/3932
<dael> fantasai: I was going over what we want for text-shadows. Came up with a bunch of questions for ::selection text-shadows
<dael> fantasai: Last time we discussed only thought about ::selection but have multiple highlight pseudos that can layer. Models discussed don't make too much sense.
<fantasai> https://github.com//issues/3932#issuecomment-510220043
<dael> fantasai: Summary ^
<dael> fantasai: Default case selection with a background suppresses text-shadows because otherwise might not get enough contrast. Spelling and grammer do not suppress text-shadows. Need to make it that having a highlight there shouldn't suppress text-shadow below
<dael> fantasai: 2 models. Any non-transparent background disables shadows on layers below. Background on any paints over layers below.
<dael> fantasai: Highlight pseudos might want to change order and paint background inbetween
<dael> fantasai: There are questions on multi-layers with text-shadows and they all spec text shadow do we draw top most non-none? All?
<dael> fantasai: I don't have a clear answer to these questions so I want feedback from WG
<dael> AmeliaBR: I don't think have any other way in CSS where you can composit together text-shadow from different declarations
<dael> fantasai: Right, because shadows inherit. Parent inherits to child so shadow takes effect on child unles syou do something. Here is a bunch of layers without parent/child so no clear inheritence. But we don't want something like spelling-error to prevent a shadow
<fantasai> s/shadow/shadow just because it now exists/
<dael> AmeliaBR: As with everything on selection highlight classes I wish we could make sense of this in normal cascade way. I think trying to draw 2 text shadows on same text is strange.
<dael> AmeliaBR: For background layering multiple backgrounds seems to make sense. Question of if it's performant to draw shadows that will be obsurced.
<dael> fantasai: I don't care if we draw background over or don't draw because the background will obscure. Either gets reasonable behavior
<dael> astearns: Main thing is pick easily impl and can be consistent. Seems edge case b/c selection happens on editable text.
<dael> fantasai: COuld select to copy out. THat's frequent
<dael> smfr: Some add funcky text shadow to change anti-aliasing
<dael> astearns: ooh, fun.
<dael> smfr: I'm confused about how thigns are supposed to work. Understand text-shadow style gets cascade into text-shadow on elemnt and paint result. fantasai sounds like saying selection has own text-shadow style hence the layers
<dael> fantasai: Didn't quite follow. In this case you have a word and it is a spelling error and a grammar error and it's selected.
<dael> fantasai: Properties on each pseudo element cascades in and inherited through...trying to remember b/c changed...[reads spec]
<dael> fantasai: You aren't going to have the text-shadow value inherit from base document element. Properties are inherited from parent. Each element has own ::selection and the ::selection of span inherits from ::selection of p which inherits from ::selection of body. Text-shadow around that word text-shadow prop won't have that value on it.
<dael> fantasai: If going to draw text we would see text-shadow:none and that's not okay for spelling error. You don't expect a spelling error to suppress shadows. Even though spelling errors don't have text-shadow you want to draw the shadow
<fantasai> https://drafts.csswg.org/css-pseudo-4/#highlight-cascade
<dael> smfr: It's about the decoration style clobbering the text-shadow of unselected version
<dael> fantasai: Could do it for selection, but not for spelling and grammar. Making it disappear with only difference is underline doesn't make sense and could make text unreadable
<dael> smfr: Impl no problem paining multi shadow. Prefer to avoid complex logic if thigns are transparent
<dael> fantasai: 2 related questions. 1: How do we deal with suppressing shadows when drawing background b/c selection has background. Can do that by saying if bg in non-transparent we don't paint shadows below. Or paint shadows first and then paint background
<dael> smfr: bg may nto be opaque
<dael> fantasai: Right. Or smaller then text-shadow
<dael> fantasai: You could dsitinguish between two, but difference isn't that important question of what's easier to implement
<dael> smfr: Want to look at native platform to see if those make sense and should be matched
<dael> fantasai: Second question is if we have multi-layers spec text-shadow. So author decides spelling error creates a blurred red ext-shadow and grammar is green shadow and selection is orange shadow, do we draw all or only top most non-none?
<dael> smfr: I think draw all. Draw what author asked for
<dael> smfr: Mac native does paint text shadow under selection, I think. You do get combination
<dael> fantasai: Prop: If multiple layers with text-shadows we draw them all
<dael> fantasai: Resolve on that?
<dael> astearns: Objections?
<dael> RESOLVED: If multiple layers with text-shadows we draw them all
<dael> fantasai: Background either suppress or paint over lower level, I think smfr suggests we paint over?
<dael> smfr: Yes
<dael> fantasai: Background on a highlight layer paints over shadows on layers below
<dael> astearns: Obj?
<dael> RESOLVED: Background on a highlight layer paints over shadows on layers below
<dbaron> I'm not crazy about the background painting over thing.
<dael> astearns: Is that enough to spec interop?
<dbaron> seems like the shadows may well peek out at the edges.
<dael> fantasai: THat's enought o spec. Interop depends on impl.
<dael> astearns: There are test cases I expect will need to be ammended to cover
<dael> fantasai: Yeah
<dbaron> (I'm listening, but I'd need to reconnect in order to unmute)
<dael> astearns: dbaron you mentioned you're not crazy about peaking out? I believe that is the case and shadows will show if larger then background
<dael> fantasai: I don't care which way it goes between the 2
<fantasai> as long as we have an answer
<dael> astearns: Let's go with that option. dbaron if you have a change or obj please update the issue
<dbaron> yeah, I don't feel that strongly, but the behavior seems a bit ugly
<fantasai> Also OK if we want to make it a UA choice between the two
<dael> astearns: Anything else on this?
<fantasai> just so long as it's only those two options and not "do anything" :)

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK