focus-visible
focus-visible copied to clipboard
`:focus-visible` should match when focus is programmatically moved to inside a dialog
Whether <dialog>
or [role="dialog]
, focus should become visible when it is programmatically moved from outside to inside the dialog. i.e. if a user clicks a button that opens a dialog, and now a button is focused-by-default within the dialog per Dialog, that button should show an indicator regardless of whether the dialog was launched by a mouse or keyboard. (Probably not for touch.)
This seems like a significant usability hole in the current heuristic, which I don't see discussed directly in other issues here.
Oops, I thought I was posting in the working group issues, I see now that this is the polyfill. Same argument apples tho :D
I think this could be a kind of duplicate of #88.
I've the feeling that the implemented behavior here is the expected one, at least that it was a conscious decision. But probably is hard/impossible to cover all use cases.
@emilio is suggesting a change to FocusOptions
so people can decide when to show it or not when moving the focus via script. See https://github.com/whatwg/html/issues/7830
I think the FocusOptions
suggestion is great. I agree trying to chase these edge cases is a losing game, although I do think there are a few like this one which are succinct enough that we should cover them in the spec.