-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Add section about when to draw or not a focus ring #6523
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 sounds very mobile centric way of defining things. I don't think it would appropriate define a normative text based on examples.
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.
@alice what do you think about removing the parenthetical?
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.
thinking about this a bit more... I think we originally included that example because just saying something supports keyboard input can be kind of vague. For example, you can press spacebar to click a button, but we don't want buttons to have a focus ring unless interacted with via keyboard.
Really I think we meant "the control expects you to type some characters" which is why we provided that virtual keyboard example. I'm curious if folks have any idea on how best to express that.
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.
Thanks for the feedback.
Good point, this is not very normative text, so I'm going to give a try to a different way to describe this (this is similar to another place on the HTML spec):
I'm going to upload a new version using this text and also updating a little bit the rest (as there was another point referring to "the focused element does not support keyboard input" which is not very clear either.
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 we can explicitly enumerate a set of input types like that. In some OS, for example, type=date may not be keyboard typable.
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've been testing the behavior of different browsers on different platforms.
<select>
is a special one. It shows a focus ring in mobile in all browsers in all platforms (iOS and Android), and also shows it on desktop (except on Firefox where it doesn't show it on desktop; and on Chromium that hides it while the pop-up is open, but shows it once you've selected the element). Maybe an option could be to include select on this list and change Firefox behavior on desktop.Apart from that, things that
<input type="date">
, despite you cannot use them with the keyboard on mobile, they show a focus ring in both iOS and Android (Chromium and Firefox) while you're selecting the date. Though maybe that's not intentional, but it's the current behavior.So one option could be to include
<select>
on the explicit list of things.Another option I see is to use some open definition, like "the element supports keyboard input" and let browsers decide what to do depending on the platform. Dunno if something like that would be acceptable for normative text.
Any other idea or suggestion is welcomed, as I'm running out of ideas about how to define this thing.
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.
what if we revise for that case in a generic way "If the control accepts keyboard input such that it would paint typed characters to the screen, or acts as a proxy to selecting from a list of options" is a way to split the difference here?
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've followed @emilio suggestion on the last version.
So it mentions text control, editing host or editable element.
Defines that text controls are textarea and input with types: email, password, search, text and url.
And then adds "The user agent may draw a focus ring in other elements".
Could that be good enough?
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.
@rniwa wdyt?
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.
Now that I understand the ramifications from this spec text, I'm wondering why this text was added at all. The idea of non-editable controls not getting focus ring in WebKit comes from the fact they don't get the focus in the first place, not just the drawing of the focus ring.