ftlabs / fastclick

Polyfill to remove click delays on browsers with touch UIs
MIT License
18.66k stars 3.22k forks source link

Breaks form submit #18

Closed ghost closed 12 years ago

ghost commented 12 years ago

Hitting enter on an input field no longer executes the form submit event after instantiating FastClick.

samgiles commented 12 years ago

Confirmed in iOS6 (emulator at least). Added test case.

ghost commented 12 years ago

I am noticing after the fix above, that I have to hit the enter key twice in the ios6 emulator for it to submit.

samgiles commented 12 years ago

I can't reproduce that, I only have to hit enter once in iOS6 emulator (iPad and iPhone): http://ftlabs.github.com/fastclick/tests/18.html

ghost commented 12 years ago

Ah, your test is including version 0.3.0, while on my side I am including 0.3.2 (https://raw.github.com/ftlabs/fastclick/master/lib/fastclick.js). Please update your test with the newest version and you will reproduce the double enter issue.

mattcg commented 12 years ago

OK, I've updated the public pages so that the test loads 0.3.2 and I can reproduce the issue.

mattcg commented 12 years ago

Should be fixed. It seems when the enter key is hit on a hard keyboard or the Go button on the soft keyboard is tapped then a 'fake' click event will be dispatched, by Safari itself, to the submit-type input element (if one is present) and if preventDefault is called on this click event then the form will not be submitted.

ghost commented 12 years ago

Confirmed, 0.3.3 fixed my issue with double enter. Thanks