base-ui
base-ui copied to clipboard
[Dialog] Configure initial focus
Added the initialFocus prop to control what element is focused after the Dialog is open.
By default it focuses the first element, unless the Dialog was opened by touch interaction - in that case the Dialog itself is focused.
Part of #714
Netlify deploy preview
https://deploy-preview-732--base-ui.netlify.app/
Generated by :no_entry_sign: dangerJS against 34050160ee8537618d0bfcd0d70576efc515cb84
@vladmoroz I'll address the bug in a separate PR.
An empty string is a valid value of PointerEvent's pointerType field, so I included it here as well.
As for naming, yeah, I suppose we can think of something better. triggerType?
@michaldudak what does the empty string mean?
What about "eventType"? "triggerType" sounds like it has to do with the trigger part
An empty string is an unknown pointer type (see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType#value).
It's not really the type of the event (as this is PointerEvent or MouseEvent), but the user's input device that caused the event to fire (= triggered it).
An empty string is an unknown pointer type (see https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/pointerType#value).
Eww 😬
If the browser supports pointer device types other than those listed above, the value should be vendor-prefixed to avoid conflicting names for different types of devices.
Do we return an empty string in this case or do we pass through the original type?
Do we return an empty string in this case or do we pass through the original type?
We pass through whatever there is originally.