focus-visible icon indicating copy to clipboard operation
focus-visible copied to clipboard

Shift renders focus ring

Open michax opened this issue 7 years ago • 3 comments

During testing I've noticed that that shift press alone activates focus ring. It doesn't seem like correct behaviour. I would expect it to only appear after tab or tab + shift.

michax avatar Jun 01 '18 03:06 michax

Hey @michax, we currently turn on focus-visible anytime a user presses any keyboard key. Our thinking is that this is a signal that the user is in "keyboard mode." Can you tell me a bit more about what you were building that caused you to see this as an error? We're always interested in use cases to help us shape the design.

robdodson avatar Jun 05 '18 18:06 robdodson

Just chiming in, but shift (or any keyboard event) also causes Chrome's default focus ring to appear, as well.

Personally, it seems somewhat aggressive. Consider the case where a user is mouse-navigating and then starts entering a keyboard shortcut, e.g. MOD-A to select all text. The focused element becomes highlighted at the start, the instant MOD is first pressed. For someone who hasn't been using the keyboard, it seems incongruous.

plinehan avatar Jun 19 '18 19:06 plinehan

I agree that it may be a bit aggressive. @alice and I were chatting about it this past week. It's unclear (to me at least) if the current behavior was a conscious decision by the Chrome team, or if it's merely a side effect of how focus ring drawing is implemented. Neither Firefox nor Safari has this same behavior, but if I recall correctly, they also don't technically focus the button when you mouse click on it, whereas Chrome does.

For now, what's in the polyfill matches the :focus-visible implementation we've been working on, so technically the polyfill is "correct"—it matches the native behavior—but I think it's up for debate whether we want to keep this behavior. Any use cases you all can provide which demonstrate that the behavior is actually distracting will be really helpful. Thank you @plinehan for the MOD-A example :)

robdodson avatar Jun 19 '18 19:06 robdodson