Focus-visible appears on dialog action button when opening dialog from menu with mouse #3813
-
DescriptionWhen I open a Dialog from a Menu with a mouse click, I expected no focus-visible indicator to appear on the initial ActionButton, but a focus-visible indicator appeared instead. Link to Reproduction (or Detailed Explanation)https://ark-ui.com/docs/components/dialog?utm_source=chatgpt.com#open-from-menu Steps to Reproduce
This issue is easiest to reproduce immediately after a page reload. After interacting with other parts of the page first, it may stop reproducing. 2026-03-10.11.54.12.movArk UI Version5.34.1 Framework
BrowserGoogle Chrome Additional InformationNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
If this is an intentional design, shouldn't we try to avoid it? |
Beta Was this translation helpful? Give feedback.
-
|
This is intentional and follows the guidelines from the spec draft for focus-visible. 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. An alternative is to set focus on the content first so users can interact as needed without showing any focus ring. |
Beta Was this translation helpful? Give feedback.
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.
An alternative is to set focus on the content first so users can interact as needed without showing any focus ring.