Replies: 1 comment 3 replies
-
Thanks for the discussion. I don't think we want to do this as focus is being moved to a new place and because that new place is in a completely different (full screen takeover) UI, it's best to inform users where their focus is regardless of input modality. It's auto focus in a dialog. I don't think you're doing this, but it's worth pointing out that a textfield cannot be a dialog trigger. Instead, for accessibility, the "normal" dom version should be a button (though it may visually look like a textfield). This button then opens a full screen dialog and auto focuses the textfield in there, which is serving as your search. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I think useFocusVisibleListener should have an option to ignore virtual modality, and when virtual modality is encountered, it should instead act as if the last non-virtual modality is active.
The reason why im requesting this, is because i have a search component with a dropdown list to choose an option. Normally, it is rendered like usual in the dom (not open).
When the user opens the search component, it enters fullscreen by rendering it in a react portal on the document body.
The search component being unmounted in one location, and mounted in another, causes it to blur and then focus, which changes modality to virtual. And the focus ring behaviour breaks.
Essentially, any component that should render in another place in the dom when it gains focus, breaks useFocusVisibleListener.
My suggestion is to keep track of the last modality which is not "virtual" (will always be either "pointer" or "keyboard"). Lets call this variable "lastNonVirtualModality".
I would then like useFocusVisibleListener to take a parameter "ignoreVirtual". If ignoreVirtual is true, return the "lastNonVirtualModality" variable, instead of "currentModality".
I can create a pull request for this, but looking for some feedback before i implement it, so i dont waste time implementing something that wont be accepted.
Beta Was this translation helpful? Give feedback.
All reactions