-
Notifications
You must be signed in to change notification settings - Fork 215
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
[Popup] Default focus behaviour #435
Comments
I think option 4 would be for things like comboboxes and autocompletes (search, etc) where the user can keep typing in the text field, for example. |
Also, should it be possible to handle all 'focus scenarios' via markup? |
Exactly, the primary use case for (4) is composited controls such as these. There's also a case to be made for "teaching UI", some little bubble that comes up on page load when you want to alert the user to some new feature (for example). Immediately pulling keyboard focus directly into that popup may be too aggressive and disruptive to the user's current task. As for why (4) as the default, that's about trying to create the cleanest possible authoring story. To us it seemed simpler if the default were effectively "do nothing" (keep focus where it is), and then lean on prior art around @tlouisse as far as initial focus goes, is there anything here you'd want support from the web platform on? Some of these may best handled by web app logic + setting |
Thanks @melanierichards, no focus behavior seems like the most sensible default. Wrt the autofocus on children, that would make perfect sense indeed 👍
<popup>
#shadow-root
<button autofocus></button>
</popup>
<popup autofocus>
<button autofocus></button>
</popup> <popup delegatefocus>
<button></button>
<button autofocus></button>
</popup>
|
Thanks all for the discussion! @tlouisse, I ported your attribute processing questions to openui/open-ui#330. Closing this issue, but if I missed anything outstanding please file a bug on Open UI! Thanks! |
The explainer explains 4 ways for focus to behave.
autofocus
on and element inside the<popup>
autofocus
on the<popup>
delegatefocus
on the<popup>
I understand that the first is hard to implement as a default behaviour. Of the 3 other cases, I wonder why the last one is the default. Is there a use case for this scenario? To my understanding, there are people that like both 2 and 3 for dialogs, but besides this explainer, I don't know of a preference for option 4.
I wonder which case (2, 3 of 4) is the preferred default. There is a lot of strength in a sensible default for a widely (re-)used component.
The text was updated successfully, but these errors were encountered: