onMouseDown()
vs onClick()
#301
kevinmitch14
started this conversation in
General
Replies: 1 comment 1 reply
-
Hey @kevinmitch14, Note that first of all those decisions/implementation details are mostly coming from @radix-ui/primitives rather than @radix-ui/themes. The reason we sometimes use pointer down rather than click is usually for certain usability features which exist in native counterparts and we felt were really nice to match. One example with menus and selects in particular is that you can be efficient and do everything in one action as opposed to needing 2 separate clicks:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Looking through behaviour of the components I notice that some use
onMouseDown()
while some useonClick()
. For example a DropdownMenu, Select and Tabs useonMouseDown()
which feels more instant in some cases.I also saw this mentioned in https://interfaces.rauno.me/
Is there a criteria that is followed for deciding when to use one or the other?
For example: I am currently using
cmdk
+ Radix Dialog to create a combobox-type component. It basically looks and feels like a dropdown, so maybe I should trigger open/close with onMouseDown instead of the default Dialog behaviour. Interested to hear your thoughts and design choices!Beta Was this translation helpful? Give feedback.
All reactions