Open web-padawan opened 5 years ago
Original intent from https://github.com/vaadin/vaadin-text-field/issues/250#issue-352503454
Since the focus is moved programmatically (vs by the user) we should let the user know visually more prominently where the focus has been moved.
@jouni as you submitted the original issue, can you confirm if this is a behaviour we want?
Yes, that’s the desired behavior.
Side note: this also affects Flow keyboard shortcuts (focusing components through server-side code).
Note: implemented this in focus-visible-mixin for the next generation components.
Originally part of vaadin/vaadin-text-field#250
Description
No focus ring when focusing programmatically
It works differently from
autofocus
and does not apply thefocus-ring
state, although it should.Use cases:
vaadin-accordion
callsfocus()
when switching panels using Up and Down arrow keys. For now, I had to duplicatefocus-ring
styles and apply them tofocused
attribute too.vaadin-grid-pro
callsfocus()
when entering edit mode for the cell (which happens on dblclick as well as Tab / Enter / Space keys) and it should be clear that the control is focused. Important for the "boolean" and "select" editor types, asvaadin-checkbox
andvaadin-select
do not have blinking cursor, and do not apply any styling tofocused
attribute (onlyfocus-ring
)