Skip to content
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

Click events aren't fired for mobile devices on table rows #2931

Closed
seanadkinson opened this issue Jan 25, 2015 · 5 comments
Closed

Click events aren't fired for mobile devices on table rows #2931

seanadkinson opened this issue Jan 25, 2015 · 5 comments

Comments

@seanadkinson
Copy link

Could be missing something here, but if I have a onClick handler for a table row, mobile devices won't fire the event unless I add an onTouchStart handler, event if it's an empty function.

Fiddle here: http://jsfiddle.net/sadkinson/145k6bqc/4/

If you comment out the doNothing function in the fiddle, mobile devices won't actually fire the onClick handler when tapping the row. Tried with Safari/Chrome on IOS 8, iPhone 6.

@syranide
Copy link
Contributor

#1169 #1418

Just add cursor: pointer and iOS will emit click events as expected.

@brigand
Copy link
Contributor

brigand commented Jan 25, 2015

I wouldn't be opposed to something like onclick="" which has the aditional benefit of letting me style all clickable elements, and making the generated html clearer.

In angular projects use this css: [ng-click] { cursor: pointer }. Three birds with one stone (unless there are some serious perf problems with adding an empty onclick attribute).

@syranide
Copy link
Contributor

It's supposed to be fixed by MobileSafariClickEventPlugin, but it broke some time ago and haven't been fixed yet IIRC. cursor: pointer is the workaround for now I think.

@percyhanna
Copy link

We recently ran into this problem as well, and found that the cursor: pointer workaround worked.

NB: The cursor must be defined as a non-:hover pseudo-class selector. I've personally never cared for defining the cursor on :hover, but that pattern is likely common enough that it might cause some problems. Since the cursor isn't actually set to pointer in the element's normal state, then iOS doesn't detect that it's clickable.

@sophiebits
Copy link
Collaborator

Dupe of #1169, essentially. Should be fixed in 0.14 by my PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants