-
-
Notifications
You must be signed in to change notification settings - Fork 254
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
Stepper: replace onMousedown by onClick for consistency #1448
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @nicooprat,
Thank you for the PR. I think we're using the mousedown
handler to have faster responses from the UI and the ability to handle events earlier in the interaction chain.
Now that I think of it, I guess pointerdown
would have been better here for the same reason outlined above plus compatibility with various other pointing devices (touchscreen, stylus, etc.).
Could you try pointerdown
and see if it works for your use case?
Otherwise, from my side click
could work too.
@zernonia would click
work here instead of mousedown
/pointerdown
?
Hi, thanks for your answer. I guess |
PS. I'm currently attending an accessibility training and it's explicitely explained that no action must be registered on "down" events (mousedown, pointerdown, keydown, touchstart) unless specifically needed, because some people might misclick and could need the escape way of dragging out before releasing the click. |
Yoo @nicooprat ! The Stepper implementation was heavily ported from the Tab component, which has a similar action on Trigger component (specifically I'm not 100% sure regarding the reason but this is what the other major a11y focus library were doing (namely Radix, React Spectrum) |
Thanks, I answered in a related discussion in Radix repo: radix-ui/themes#301 (reply in thread) |
Awesome @nicooprat ! I will set this to |
Using
mousedown
event can lead to some edge cases.In our app, changing step changes the modal content, thus its height, and a mouseup event would then be fired outside the modal: so changing step was actually closing the modal... it was hard to find why!
Also, this would be better for accessibility because I think using
enter
actually trigger theclick
event natively.I can't think of any reason why using
mousedown
would be better, but I might be wrong!Related: #1330