Skip to content

Focus ring appears on autoFocus button in dialog even when opened with mouse click #8182

Answered by snowystinger
martinostvik asked this question in Q&A
Discussion options

You must be logged in to vote

This is intentional and follows the guidelines from the spec draft for focus-visible.
https://drafts.csswg.org/selectors/#the-focus-visible-pseudo which says

If a newly-displayed element automatically gains focus (such as an action button in a freshly opened dialog), that element should indicate focus.

We think it's an important step to assist users in knowing that focus has moved somewhere they did not explicitly try to send it. If a user decides to switch modality upon entering a dialog for example, it's useful to know if focus went to a cancel, confirm, or some other child of the dialog such as a form element, without needing to press Esc (could potentially also cancel) or Tab (could…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by martinostvik
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants