-
Notifications
You must be signed in to change notification settings - Fork 664
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-selectors-4] browser focus styles and focus-visible, example 38 #4278
Comments
I think that while the default stylesheet on the UAs are using For example you have a |
Which UA sheet is using |
(AFAICT in Gecko all UA sheets use |
Chromium is using WebKit uses |
I believe that the problem might be that Chromium has implemented something different than what the initial idea was, and that's why this confusion arise. Maybe I'm wrong but let's me explain my thoughts next. The spec says:
So let's use again a very simple example: <div tabindex="1">Click me!</div> When you click on that element Chromium (and WebKit) shows an outline, however in Chromium it doesn't match I guess Chromium is implementing this other part of the spec:
So if Chromium decides to change the UA sheet to use It'd be nice to understand why Chromium did this and why the UA sheet is still not using |
I think this is just a Chromium bug, tbf. Chromium should be using |
This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. See issue w3c/csswg-drafts#4278. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match :focus-visible (see https://crbug.com/1162070).
I agree, I've just reported https://bugs.chromium.org/p/chromium/issues/detail?id=1162070 And also created a test that fails in Chromium due to this (and pass in Firefox) at web-platform-tests/wpt#27015 |
This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. See issue w3c/csswg-drafts#4278. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match :focus-visible (see https://crbug.com/1162070).
This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. See issue w3c/csswg-drafts#4278. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match :focus-visible (see https://crbug.com/1162070).
This matches Firefox, and the intent of this CSS pseudo-class, see w3c/csswg-drafts#4278.
This matches Firefox, and the intent of this CSS pseudo-class, see w3c/csswg-drafts#4278.
This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. See issue w3c/csswg-drafts#4278. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match :focus-visible (see https://crbug.com/1162070).
This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. See: w3c/csswg-drafts#4278 & whatwg/html#6256 Currently Chromium and WebKit pass this test, because despite they don't use `:focus-visible` in the UA stylesheet, they're painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline.
This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. See: w3c/csswg-drafts#4278 & whatwg/html#6256 Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the background color doesn't match on the test).
This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. See: w3c/csswg-drafts#4278 & whatwg/html#6256 Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the background color doesn't match on the test).
This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. See: w3c/csswg-drafts#4278 & whatwg/html#6256 Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the background color doesn't match on the test).
Just ramping back up post-vacation, sorry for the dealy!
Yes, I believe that's correct.
I think @alice can speak more to this. My guess is that we didn't want to change too many things at once so it seemed safer to ship |
@robdodson That's right. Wanted to make one change at a time. |
Thanks for the feedback @robdodson and @alice, would you mind confirming that you agree with the change on HTML spec on @emilio's PR: whatwg/html#6256 ? |
It seems like that isn't blocked on me or Rob, but rather on feedback on https://crbug.com/1162070#c7 |
This patch adds 2 new tests to verify that the default UA style sheet uses `:focus-visible { outline: auto; }`. See: whatwg/html#6256 & w3c/csswg-drafts#4278 * focus-visible-017.html: This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the test is specifically checking for `:focus-visible` support). * focus-visible-018.html: This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match `:focus-visible` (see https://crbug.com/1162070).
This patch adds 2 new tests to verify that the default UA style sheet uses `:focus-visible { outline: auto; }`. See: whatwg/html#6256 & w3c/csswg-drafts#4278 * focus-visible-017.html: This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the test is specifically checking for `:focus-visible` support). * focus-visible-018.html: This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match `:focus-visible` (see https://crbug.com/1162070).
This patch adds 2 new tests to verify that the default UA style sheet uses `:focus-visible { outline: auto; }`. See: whatwg/html#6256 & w3c/csswg-drafts#4278 * focus-visible-017.html: This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the test is specifically checking for `:focus-visible` support). * focus-visible-018.html: This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match `:focus-visible` (see https://crbug.com/1162070).
… in the default UA style sheet, a=testonly Automatic update from web-platform-tests [selectors] Add tests for :focus-visible in the default UA style sheet This patch adds 2 new tests to verify that the default UA style sheet uses `:focus-visible { outline: auto; }`. See: whatwg/html#6256 & w3c/csswg-drafts#4278 * focus-visible-017.html: This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the test is specifically checking for `:focus-visible` support). * focus-visible-018.html: This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match `:focus-visible` (see https://crbug.com/1162070). -- wpt-commits: 08069be5028d00518abd36e132275252937a34d3 wpt-pr: 27015
… in the default UA style sheet, a=testonly Automatic update from web-platform-tests [selectors] Add tests for :focus-visible in the default UA style sheet This patch adds 2 new tests to verify that the default UA style sheet uses `:focus-visible { outline: auto; }`. See: whatwg/html#6256 & w3c/csswg-drafts#4278 * focus-visible-017.html: This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the test is specifically checking for `:focus-visible` support). * focus-visible-018.html: This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match `:focus-visible` (see https://crbug.com/1162070). -- wpt-commits: 08069be5028d00518abd36e132275252937a34d3 wpt-pr: 27015 UltraBlame original commit: 990ee1b12d5a1243273aa37a90bd99326eb8dcf8
… in the default UA style sheet, a=testonly Automatic update from web-platform-tests [selectors] Add tests for :focus-visible in the default UA style sheet This patch adds 2 new tests to verify that the default UA style sheet uses `:focus-visible { outline: auto; }`. See: whatwg/html#6256 & w3c/csswg-drafts#4278 * focus-visible-017.html: This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the test is specifically checking for `:focus-visible` support). * focus-visible-018.html: This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match `:focus-visible` (see https://crbug.com/1162070). -- wpt-commits: 08069be5028d00518abd36e132275252937a34d3 wpt-pr: 27015 UltraBlame original commit: 990ee1b12d5a1243273aa37a90bd99326eb8dcf8
… in the default UA style sheet, a=testonly Automatic update from web-platform-tests [selectors] Add tests for :focus-visible in the default UA style sheet This patch adds 2 new tests to verify that the default UA style sheet uses `:focus-visible { outline: auto; }`. See: whatwg/html#6256 & w3c/csswg-drafts#4278 * focus-visible-017.html: This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the test is specifically checking for `:focus-visible` support). * focus-visible-018.html: This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match `:focus-visible` (see https://crbug.com/1162070). -- wpt-commits: 08069be5028d00518abd36e132275252937a34d3 wpt-pr: 27015 UltraBlame original commit: 990ee1b12d5a1243273aa37a90bd99326eb8dcf8
… in the default UA style sheet, a=testonly Automatic update from web-platform-tests [selectors] Add tests for :focus-visible in the default UA style sheet This patch adds 2 new tests to verify that the default UA style sheet uses `:focus-visible { outline: auto; }`. See: whatwg/html#6256 & w3c/csswg-drafts#4278 * focus-visible-017.html: This test checks that when you focus an element via script, it show a focus ring with `outline-style: auto`. Currently Chromium passes this test, because despite they don't use `:focus-visible` in the UA stylesheet, it's painting an auto style outline when an element is focused. However Firefox fails it, because even when it uses `:-moz-focusring` (the equivalent to `:focus-visible`) in the UA stylesheet, it uses dotted style for the outline. WebKit doesn't support `:focus-visible` yet an it fails, thought it's painting an auto style outline (the test is specifically checking for `:focus-visible` support). * focus-visible-018.html: This test checks that when you click an element to focus it, it doesn't show any kind of focus ring. Currently Firefox passes this test, by Chromium fails it because Chromium is using `:focus` on the default UA stylesheet and is adding an outline on the element, despite it doesn't match `:focus-visible` (see https://crbug.com/1162070). -- wpt-commits: 08069be5028d00518abd36e132275252937a34d3 wpt-pr: 27015
The CSS Working Group just discussed
The full IRC log of that discussion<myles> Topic: [css-selectors-4] browser focus styles and focus-visible, example 38<myles> GitHub: https://github.com//issues/4278 <myles> rego: florian reported it, but I added it to the agenda <myles> rego: florian was asking about focus-visible in the spec. Was asking about using focus-visible to remove the old line from the element <myles> rego: The thing is that, this was confusing to some people, and kind of a hack to disable the whole line instead of the focus when you have focus visible, to see the whole line but not always <myles> rego: this is kind of confusing. you expect when it matches focus-visible, it matches only when the outline is painted. <myles> rego: and if it's not painted it's not <myles> rego: chromium was not using that in its default visible. So you would get an outline but the element wasn't matching focus-visible <florian> q+ <myles> rego: Chromium's impl is updated. The default stylesheet uses focus-visible. So this example can be removed from the spec. Because it was only due to some browsers' implementations. <myles> florian: We should double remove it. <myles> florian: This is no longer how browsers work. It shouldn't stay there. Also, even when we were before that change, specs are a bad place to put descriptions of hacks you need to use to force browsers to not follow the spec behave correctly. And if we do that, it needs to be described deliberately <myles> florian: now that it's no longer relevant, remove it, and if we need to highlight workarounds in the spec, be clear they are workarounds. <Rossen_> q? <Rossen_> ack florian <myles> rego: So the proposal is to remove the example from the sepc <myles> bkardell_: We should remove it. My recollection is that we added that to help people understand what it was doing, because you could explain that focused matched all the time, and people said it this way, but people wanted to remove it when that wasn't the case. but that made it into the spec in a way that it should not have. we should take it out. <myles> Rossen_: proposed resolution: remove the example <fantasai> If we agree on something, we resolve on it, so it's clear there was an agreement. <myles> RESOLVED: remove the example |
:focus:not(:focus-visible) is a workaround due to some implementations not following the spec (not using :focus-visible in the default UA style sheet). Apart that this is no longer needed as implementations have been updated, this kind of workarounds shouldn't be in the spec as they're confusing. Fixes w3c#4278
…#4278) :focus:not(:focus-visible) is a workaround due to some implementations not following the spec (not using :focus-visible in the default UA style sheet). Apart that this is no longer needed as implementations have been updated, this kind of workarounds shouldn't be in the spec as they're confusing. Fixes w3c#4278
…3c#4278) :focus:not(:focus-visible) is a workaround due to some implementations not following the spec (not using :focus-visible in the default UA style sheet). Apart that this is no longer needed as implementations have been updated, this kind of workarounds shouldn't be in the spec as they're confusing. Fixes w3c#4278
…4278) (#5974) :focus:not(:focus-visible) is a workaround due to some implementations not following the spec (not using :focus-visible in the default UA style sheet). Apart that this is no longer needed as implementations have been updated, this kind of workarounds shouldn't be in the spec as they're confusing. Fixes #4278
…3c#4278) (w3c#5974) :focus:not(:focus-visible) is a workaround due to some implementations not following the spec (not using :focus-visible in the default UA style sheet). Apart that this is no longer needed as implementations have been updated, this kind of workarounds shouldn't be in the spec as they're confusing. Fixes w3c#4278
* Editorial: remove redundant "the" * Meta: default branch rename Also correct a broken link. Not even w3.org URLs are that cool. Helps with whatwg/meta#174. * Editorial: clean up calls to "parse a URL" It actually takes a string, so calls should be clear about that. * Review Draft Publication: January 2021 * Simplify <link>s In particular, remove their activation behavior, stop them from matching :link and :visited, and stop suggesting that they be focusable areas. This also includes a slight expansion and rearrangement of the link element's section to make it clearer what hyperlinks created by <link> are meant for, contrasting them to <a> and <area> hyperlinks. Closes whatwg#4831. Closes whatwg#2617. Helps with whatwg#5490. * Meta: remove demos/offline/* (whatwg#6307) These are no longer needed as of e4330d5. * Meta: minor references cleanup Use more HTTPS and drop obsolete HTML Differences reference. * Editorial: anticlockwise → counterclockwise We use en-US these days. Spotted in https://twitter.com/iso2022jp/status/1352601086519955456. * Use :focus-visible in the UA stylesheet See w3c/csswg-drafts#4278. * Editorial: align with WebIDL and Infra * Fix "update a style block" early return The new version matches implementation reality and CSSWG resolution. The algorithm was also inconsistent, as it looked at whether the element was in a shadow tree or in the document tree, but it was only specified to be re-run if the element becomes connected or disconnected. The CSSWG discussed this in w3c/csswg-drafts#3096 (comment) and http://wpt.live/shadow-dom/ShadowRoot-interface.html tests this. This also matches closer the definition of <link rel="stylesheet">, which does use connectedness (though it uses "browsing-context connected", which is a bit different): https://html.spec.whatwg.org/#link-type-stylesheet * Modernize and refactor simple dialogs This contains a small bug fix, in that confirm() and prompt() said "return" in some cases instead of "return false" or "return null" as appropriate. Other notable changes, all editorial, are: * Factoring out repeated "cannot show simple dialogs" steps, which will likely expand over time (see e.g. whatwg#6297). * Separating out and explaining the no-argument overload of alert(). * Passing the document through to the "printing steps", instead of just having them talk about "this Window object". * Meta: add definition markup for MessageEvent * Remove <marquee> events They are only supported by one engine (Gecko). Closes whatwg#2957. * Clarify when microtasks happen * Ignore COEP on non-secure contexts Fixes whatwg#6328. * Editorial: update URL Standard integration * Editorial: only invoke response's location URL once Complements whatwg/fetch#1149. * Track the incumbent settings and active script in Promise callbacks Closes whatwg#5213. * createImageBitmap(): stop clipping sourceRect to source's dimensions It has been found in whatwg#6306 that this was an oversight at the time of its introduction. Current behavior goes against author expectations and no implementer has opposed the change to "no-clip". Tests: web-platform-tests/wpt#27040. Closes whatwg#6306. * Remove CSP plugin-types blocking With Flash not being supported anymore, the CSP directive plugin-types has lost its main reason for being and is being removed from the Content Security Policy specification: w3c/webappsec-csp#456. This change removes references to the relevant algorithm from the Content Security Policy spec. * Meta: set more dfn types A follow-up to: * whatwg#5694 * whatwg#5916 * Editorial: occuring → occurring * Make all plugin-related APIs no-ops Part of whatwg#6003. * Disallow simple dialogs from different-origin domain iframes Closes whatwg#5407. * Revive @@iterator for PluginArray/MimeTypeArray/Plugin @@iterator is implicitly installed by defining an indexed property getter. Since there is no other way to define it exclusively, this restores some methods back to being indexed getters. This fixes an inadvertent observable behavior change in d4f07b8. * Adjust web+ scheme security considerations to account for FTP removal Also, network scheme is now reduced to HTTP(S) scheme. Helps with whatwg#5375, but form submission issue remains. See whatwg/fetch#1166 for context. * Meta: export pause Nobody but XMLHttpRequest take a dependency on this please. You have been warned. Context: whatwg/xhr#311. * Fix typo: ancestor → accessor Fixes whatwg#6374. Co-authored-by: Dominic Farolino <domfarolino@gmail.com> Co-authored-by: Anne van Kesteren <annevk@annevk.nl> Co-authored-by: Domenic Denicola <d@domenic.me> Co-authored-by: Emilio Cobos Álvarez <emilio@crisal.io> Co-authored-by: Momdo Nakamura <xmomdo@gmail.com> Co-authored-by: Jake Archibald <jaffathecake@gmail.com> Co-authored-by: Yutaka Hirano <yhirano@chromium.org> Co-authored-by: Shu-yu Guo <syg@chromium.org> Co-authored-by: Kaiido <tristan.fraipont@gmail.com> Co-authored-by: Antonio Sartori <anton.sartori@gmail.com> Co-authored-by: Michael[tm] Smith <mike@w3.org> Co-authored-by: Ikko Ashimine <eltociear@gmail.com> Co-authored-by: Carlos IL <carlosjoan91@gmail.com> Co-authored-by: Kagami Sascha Rosylight <saschanaz@outlook.com> Co-authored-by: Simon Pieters <zcorpan@gmail.com>
My understanding of :focus-visible was that it gave authors access to the existing logic by which browsers style focused elements, so that authors could change that, without adding focus indicators onto things where the browser wouldn't, which is what would happen if they used :focus instead.
However, the spec, and in particular example 38, suggest that authors could write something like:
in order to suppress browser-supplied focus indicators on elements that match :focus but not :focus-visible.
That's very confusing to me, as by my understanding, there should be no such element. The sentence immediately before the example also seems to agree with me.
Maybe that selector is meant as a poor man's
@support
for selectors, but it's given what the rest of the example does, it's not needed or useful.If I'm right, this example is causing confusion and inducing authors to think that they need to use
:focus:not(:focus-visible)
to select and suppress undesirable browser styles, which is just not true. In that case, this should be removed from the example.If I'm wrong, I'd like to understand why, because then the feature no longer makes sense to me.
The text was updated successfully, but these errors were encountered: