Skip to content
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

[field-base] Add support for focus({ focusVisible: true }) to force setting focus-ring #1357

Open
jouni opened this issue Aug 21, 2018 · 2 comments

Comments

@jouni
Copy link
Member

jouni commented Aug 21, 2018

Focus ring on touch devices

<vaadin-text-field autofocus>

The field gets the focus-ring (and focused, judging by the blue label text) state also on touch devices. It should not, as at least iOS prevents autofocus from working at all (it will not focus the field and open the keyboard).

No focus ring when focusing programmatically

textField.focus();

Works differently from autofocus and does not apply the focus-ring state, although it should. You can use the same https://vaadin-login-proto.glitch.me example to see the behavior (click the “Log in” button which moves the focus to the “Username” field).

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.

@web-padawan
Copy link
Member

web-padawan commented Jan 2, 2019

Also faced this (second part, regarding programmatic focus) while working on accordion, actually it might make sense to handle this in vaadin-control-state-mixin. I had to duplicate some styles - especially, for accordion panel, I apply the styles to focused state instead of just using focus-ring.

@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-text-field May 19, 2021
@web-padawan web-padawan changed the title Inconsistent focus style behavior [control-state-mixin] Inconsistent focus style behavior May 28, 2021
@web-padawan web-padawan changed the title [control-state-mixin] Inconsistent focus style behavior [field-base] Add support for focus({ focusVisible: true }) to force setting focus-ring Aug 16, 2022
@web-padawan
Copy link
Member

The HTML Standard has added a focusVisible option for the focus method, see whatwg/html#8087

button.focus({ focusVisible: true })

I propose to implement the same API in our components overriding focus() method. Renamed the issue accordingly.

@web-padawan web-padawan added enhancement New feature or request a11y Accessibility issue and removed bug Something isn't working labels Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants