-
Notifications
You must be signed in to change notification settings - Fork 48.5k
Click events not being triggered with ios touch devices #7635
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
@jooj123 your click event is not being registered with React's event system. By using React only normalizes and delegates event handlers registered on React components (like If you want to capture click events anywhere on the page, try rendering a |
Its what i figured - its just not ideal to do a full page |
Yeah, but if you want React to normalize your click event, it needs to be registered via React. React uses it's own top-level listener to delegate events for components, so when you use |
Going forward is it possible for react to provide an api to cater for this scenario (maybe registers react events on top document level somehow) ? Or is that going against react architectural principles ? |
You can see #284 for some discussion on that topic |
This occurs under very specific conditions:
You have a :hover rule for an element that is clickable. The styles in that rule don't matter, the rule can even be empty. |
@Yogi2001 what is the solution? I cannot find a valid workaround for this specific usecase and your link seems to be dead unfortunately? I have exactly the same specific issue/conditions.. Hope you can help out. |
@demanzonderjas |
After trying what seemed like everything, including all of the above, I found one more case where this would occur, other event(s) was interfering with the click event. I had a mouseenter and mouseleave event that for some reason took some focus away, they certainly shouldn't have, but they did. Maybe that can help someone looking at solving this annoying problem. |
Possible bug, I have created this JS Fiddle:
http://jsbin.com/piqolixixi/edit?html,css,js,output
On desktop if i click anywhere (on the components or outside of the components) I get the "Clicked!" alert - which is expected, as on mount I have registered the click event
onClick
in theHello
component.If I try the same thing on a ios touch device (im using an ipad mini model A1432, ios 9.3.2)
The click events are not triggered when i touch the react components (
Hello
andHelloOther
).But if I touch outside of the components the alert comes up.
Whats interesting is that if i add
cursor: pointer;
css to the components they will then get triggered.Looks like its some sort of regression around this issue:
#2055
I have tried react versions 0.14 to 15.x - same issue
The text was updated successfully, but these errors were encountered: