-
Notifications
You must be signed in to change notification settings - Fork 724
Emphasize most common uses of fireEvent #469
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
Comments
-- https://w3c.github.io/uievents/#event-type-click That being said: You can still dispatch synthetic clicks and trigger the handler. React just does not register it: https://codesandbox.io/s/react-dispatch-synthetic-middle-mouse-button-l0u4g Feel free to open an issue on the react repo if you have a use case for dispatching synthetic middle mouse clicks.
-- https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons |
@eps1lon, thanks for the detailed explanation. Never knew that something like If my new understanding is correct, then I believe that the docs should be corrected:
|
definitely. I think the docs should rather document a change event. For clicks you have |
@eps1lon, @nickmccurdy I'd like to help out with this issue, but I need some clarification. I've read through the thread and it looks like the original issue was that it wasn't clear that middle (1) and right (2) mouse click events don't dispatch a click event. I'm a little confused about that since it looks like in the OP So is it my understanding that this piece of the documentation is incorrect:
Would it suffice to remove this example since (AFAIK) it doesn't work? Lastly, could I get some more clarification on what is meant by the "most common uses" of Thanks! |
These should not be observable in a browser. Since we're all about testing how a user interacts, we should not docoument these esoteric usages. Closes #469
@testing-library/dom
version: 7.5.7Relevant code or config:
What you did:
I was trying to right-click on an element in my test using
fireEvent.click(element, { button: 2 })
.What happened:
No event was fired.
Reproduction:
Please see code above. The click handler is called only twice, with button=0 and button=1. It is not called with button=2.
Problem description:
fireEvent.click() does not work for right-click.
Also the docs are a bit confusing. They imply that for left-click use button=0 and for right-click use button=2. However according to MDN docs, 0 is no buttons, 1 is left button, 2 is right button - there is a mismatch. Please see below:
The text was updated successfully, but these errors were encountered: