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
Explain focus-visible intent and guidance. #2481
Conversation
selectors-4/Overview.bs
Outdated
This pseudo-class is intended to give developers the ability to style focus | ||
selectively, in order to encourage visible, usable focus styles, and | ||
discourage the practice of disabling the default user agent focus style. | ||
|
||
<div class=advisement> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this section be removed, as it's essentially duplicated below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
selectors-4/Overview.bs
Outdated
use '':focus-visible''. | ||
</div> | ||
This pseudo-class is intended to give developers the ability to style focus | ||
selectively, in order to encourage visible, usable focus styles, and |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As a developer, personally I find the previous form of words more straightforward and easier to understand. I'm struggling particularly with the word 'selectively'. The purpose of :focus-visible
is, as I understand it, to style the focus ring while not overriding the UA's discretion about whether to display it. Therefore this mechanism intentionally doesn't give the developer control over that discretion, whereas I'd interpret 'selectively' in this text as implying that it does.
I'm sorry not to be able to suggest an alternative form of words here but I don't think I have a strong enough understanding of the motivation for the change. Is there a desire to be less opinionated about developer behaviour?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks reasonably good, but a few comments. (We're looking at this in the TAG meeting as part of processing w3ctag/design-reviews#233.)
selectors-4/Overview.bs
Outdated
* If a keyboard event occurs while an element is focused, | ||
even if the element wasn't focused by a keyboard interaction, | ||
apply '':focus-visible''. | ||
Since part of the problem is user agents' default focus indicator behaviour, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please prefer US spelling of behavior.
selectors-4/Overview.bs
Outdated
* If a keyboard event occurs while an element is focused, | ||
even if the element wasn't focused by a keyboard interaction, | ||
apply '':focus-visible''. | ||
Since part of the problem is user agents' default focus indicator behaviour, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if "the problem" should be spelled out in slightly more words, as well, since it doesn't seem tied to the previous paragraph.
selectors-4/Overview.bs
Outdated
@@ -2256,20 +2256,9 @@ The Focus-Indicated Pseudo-class: '':focus-visible''</h3> | |||
like clicking on the button with a mouse pointer. | |||
</div> | |||
|
|||
<div class=advisement> | |||
Page authors should follow these guidelines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems a little disappointing to remove all of the advice for authors. It's not clear to me that the old advice was the best that could be offered, but this does seem like an area where it's worth offering some expert advice on what the right thing really is.
selectors-4/Overview.bs
Outdated
apply '':focus-visible''. | ||
Since part of the problem is user agents' default focus indicator behaviour, | ||
it is recommended that browsers implementing the `:focus-visible` | ||
selector also use it in their user agent stylesheets to show the default focus |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think "show" is quite the right verb here. It's possible it could even be "explain", or perhaps "specify". It might also help to add an additional clarifying sentence saying that the point is that when :focus-visible
matches should correspond to the UA's default behavior for when to show focus indicators. In fact, it might be worth stating that as a conformance requirement (and then saying that an easy way to implement that requirement may be by using :focus-visible
in the UA style sheet.)
Thank you for the reviews @dbaron and @triblondon! I'll revise and ping the thread again when it's ready for another look. |
selectors-4/Overview.bs
Outdated
</div> | ||
This pseudo-class is intended to give developers the ability to style focus | ||
selectively, in order to encourage visible, usable focus styles, and | ||
discourage the practice of disabling the default user agent focus style. | ||
|
||
When UAs choose to specially indicate focus on an element, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this paragraph confuses the issue about the problem we're trying to solve. The problem is the practice of disabling the default UA focus style, mentioned in the previous paragraph.
Thanks for the feedback - we're going to close this PR for now while we figure out exactly what advice we want to give browser implementors and authors respectively. |
@tabatkins — we wanted to more thoroughly explain the intent of the focus-visible pseudo, and improve the conformance guidelines. This is our first stab at it, any feedback you (or others) have is much appreciated.
cc @alice @bkardell