Repository navigation
Description
Description
There are 3 areas that could use interop attention:
- Only Chrome on macOS lets
outline-coloralone change the outline. Firefox and Safari ignore the color request and continue drawing their default outline styles outline-colorshould allow the value ofinvertand only Firefox handles that correctly per spec, it does this by using currentColor- If authors do want to change the color of the outline, across browser, they currently must pass
outline-style, which has the side effect of no longer matching the border radius of the focused element
Rationale
There was a lot of positive developer feedback when Chrome aligned with Firefox and Safari on making the outline follow the shape of the element. This meant no more box-shadow focus outlines were needed anymore.. mostly. Recently I did a dive into the cross browser customization of this nice shapes focus outline, and found some issues that I've listed above in the description. I still see the box-shadow "hack" in the wild, like in this material component or this article. It's my understanding that these box-shadow solutions don't work for forced color modes or high contrast modes.
Half of the great work is done, having the outline follow the element shape, but it's a big bummer that attempts to customize the color to match a brand means losing the shape. We want people using the built in focus indicator.
Specification
Tests
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsProposed
Activity
jelbourn commentedon Oct 12, 2022
Could this also include
outline-radius? Material Design, for example, plans to continue avoidingoutlinebecause they have cases where they don't want the focus ring to exactly match the focused element's border radius.karlcow commentedon Oct 13, 2022
@jelbourn Does that solve your issue?
https://bugs.webkit.org/show_bug.cgi?id=20807
jelbourn commentedon Oct 13, 2022
Not quite- this is secondhand from Google's Material Design folks, but apparently there are situations where they'd like the focus ring to have a different radius than the element itself.
gsnedders commentedon Oct 14, 2022
Is
outline-radiuseven specified anywhere currently, or is there even an open CSS WG issue requesting it? It seems small enough it might be possible to move quickly enough for this to be suitable for 2023, but it would require standardisation to move quickly.karlcow commentedon Oct 14, 2022
It doesn't seem so.
https://github.com/w3c/csswg-drafts/search?q=outline+radius&type=issues
@jelbourn Google's Material Design folks should contact the CSS WG or someone from Google in the CSSWG. Maybe that could clarify the perimeter of the issue.
argyleink commentedon Oct 14, 2022
there used to be
-moz-outline-radiusbut it doesnt appear to be prototyped anymore in Firefoxfoolip commentedon Oct 31, 2022
Since today is the last day to refine proposals, let's make it final that
outline-radiusis not part of this proposal, since there's no spec for it yet.gsnedders commentedon Nov 1, 2022
I meant to ask about this last week, but the goal here is specifically how form elements have their outline rendered when they have focus? Because the majority of tests linked above don't have anything to do with focus. (And, e.g., outline-005.html fails in STP 156 because the outline doesn't follow border-radius, even if it does follow the edge of form controls).
argyleink commentedon Nov 1, 2022
specifically about "i just want to change the color" and not get side effects
emilio commentedon Nov 3, 2022
@argyleink I believe this is just w3c/csswg-drafts#7761? Firefox follows
accent-colorwhich I think is a reasonable thing to do.3 remaining items
emilio commentedon Nov 3, 2022
It's always double, the alternative color is the "accent foreground" color, which is usually white, but can be a darkened version of the accent color if it's too light. It's basically whatever color the checkbox checkmark etc are.
foolip commentedon Nov 11, 2022
In the State of CSS 2022 question about browser incompatibilities, there were 13 responses categorized as
outline. A sample of those:These two about focus might also be pointing at the same issue:
This wasn't enough to make the top list in #248, but I'd consider it a medium strength signal since a bunch of comments point to a specific problem.
gsnedders commentedon Nov 11, 2022
None of these are about focus outlines, though, are they? They're just about the behaviour of outline in general. See my question about scope above.
foolip commentedon Nov 11, 2022
@gsnedders I'm not especially familiar with this, but assumed that
outlinecan be used to control the styling of the focus outline, and I just confirmed that with the following:Whether the comments from State of CSS are about focus outlines or other uses of outlines is hard to say, but since they mention radius and many focusable things have rounded corners, it's not very far fetched.
Is the scope of this proposal still unclear though? If so I'm sure @argyleink will be happy to clarify.
foolip commentedon Nov 11, 2022
In the MDN short survey on CSS & HTML, "CSS
outlineproperty (includingoutline-color)" was selected by ~14% of survey takers, putting it in the middle third of the 20 options. (There is some uncertainty as with any survey data.)[-]Focus Outline[/-][+]Focus Outline Color[/+]argyleink commentedon Nov 11, 2022
most of the comments you shared about outlines were about the shape of the outline following the shape of the element that's in focus. there was previously poor interop here on this behavior, but it's been remedied. BUT, that being said, changing the color of the outline shouldnt revert the shape following behavior to the previous behavior (where the shape of the element was ignored). that's what this issue is about, that change the color of it shouldnt effect the shape. there was a lot of fanfare once outlines follow element shape (they're ugly when they dont follow), but if we want that shape apparently we can't change the color because it forces paint down the old code path. hence the term side effects in the description: i changed the color but for some reason got a shape change.
jensimmons commentedon Nov 13, 2022
It's still unclear what this proposal is about.
jensimmons commentedon Nov 15, 2022
Are we to assume that this proposal is only about
outline-colorinterop, as originally proposed. And not everything else discussed?Are there any tests for
outline-color? @argyleink you linked to all tests related to outlines. Which is not the same as a narrowly-scoped proposal foroutline-colorcombined withoutline: auto.argyleink commentedon Nov 15, 2022
I'd prefer it stays scoped that way yeah
There are some, but I don't see any narrowly-scoped tests for
outline-colorcombined withoutline: autospecifically no. Adding some would hopefully illuminate this issue and provide something to align on.jensimmons commentedon Nov 15, 2022
Thanks for your response, Adam.
We are wondering if this is in fact testable, since it's deeply affected by operating system & context.
jensimmons commentedon Nov 15, 2022
Is this a to-do list of two items, or three items?
outline-colorwork in all browsersinvertforoutline-colorIs there something for browsers to do for 3? Or are you just listing the suboptimal consequence of not doing 1 & 2? @argyleink
argyleink commentedon Nov 17, 2022
I think that's a fair view of bullet 3 yeah 👍🏻
nairnandu commentedon Feb 1, 2023
Thank you for proposing Focus Outline for inclusion in Interop 2023.
We wanted to let you know that this proposal was not selected to be part of Interop this year. We had many strong proposals, and could not accept them all. This should not be taken as a comment on the technology as a whole, and resubmitting a proposal for this feature as part of a future round of Interop would be welcome.
For an overview of our process, see the proposal selection summary. Thank you again for contributing to Interop 2023!
Posted on behalf of the Interop team.