w3c / csswg-drafts

CSS Working Group Editor Drafts
https://drafts.csswg.org/
Other
4.46k stars 657 forks source link

[css-ui] Should `outline-offset` be a longhand of `outline`? #8788

Closed Loirooriol closed 2 months ago

Loirooriol commented 1 year ago

https://drafts.csswg.org/css-ui/#outline says

The outline property is a shorthand property and sets all three of outline-style, outline-width, and outline-color.

This is verbatim taken from https://www.w3.org/TR/CSS2/ui.html#dynamic-outlines:

The 'outline' property is a shorthand property, and sets all three of 'outline-style', 'outline-width', and 'outline-color'.

But CSS UI added outline-offset, which didn't exist in CSS2. So I don't know if leaving it out of the shorthand was deliberate or not.

Loirooriol commented 4 months ago

BTW, it's not a longhand in Gecko/Blink/WebKit.

frivoal commented 4 months ago

Its introduction predates my involvement with css-ui, so I am not sure if it is deliberate or not, but I would be cautious about changing it now. We most likely have a lot of content with built-in assumptions that changing the value of outline does not reset outline-offset, and changing the relationship would invalidate that. In particular, I worry that outline-offset is used to ensure that the outline is visible, in cases where it may otherwise be obscured by other content, or by a container whose overflow is not `visible. Resetting it could then make the outline invisible, and that could get in the way of accessibility, as it is often used as a focus indicator.

If we could ascertain that there is no compat problem, then I'd be in favor of the change, but I am skeptical that we can.

dbaron commented 2 months ago

I'm not even sure I'd be in favor of this if we were starting from scratch. I think it's quite reasonable to want to change the outline style, width, and color all together without changing the offset. I think the outline style/width/color are "what does the focus outline look like" and outline-offset is "where does the focus outline go". (It's sort of like margin, but it's an entirely separate margin just for the outline.)

Loirooriol commented 2 months ago

I'm fine with not including outline-offset in the shorthand, but then I would like a clarifying note like in https://drafts.csswg.org/css-text-decor-3/#text-decoration-property

The shorthand purposefully omits the text-underline-position property, which is a language/writing-system–dependent setting that keys off the content, so that it can cascade and inherit independently from the (uninherited) stylistic settings of the text-decoration shorthand.

frivoal commented 2 months ago

I've added a note, as suggested above. That's just an editorial change, so we don't need a group resolution for that.

Should we close this issue, or do we want an explicit group resolution about making no normative change? (cc: @atanassov @astearns )

astearns commented 2 months ago

@Loirooriol go ahead and close this issue if you are good with the current outcome