Open laurentgoudet opened 10 years ago
@laurentgoudet I tried your forked version but I still see the same behaviour on selects.
I'm experiencing this issue as well. Would love to see a fix.
+1 having the same issue.
thanks @laurentgoudet, your revert fix works for me
Have the same: If select not scrolled to center of the screen, after click it looses focus and the focus goes to next or prev input.
This works for me:
$('#my-select').on('touchstart',function(e) {
e.preventDefault();
});
Tested on Safari and Chrome @ iOS7
@Deliaz That fixes the issue in iOS, but prevents selects from being used in Chrome on Android for example. (tested @ Nexus4)
@laurentgoudet Were you able to find a fix for this? Or did you stick with reverting the mentioned fix?
@mgustafsson1 like @laurentgoudet I rolled back #226 changes on my project and it seems to have resolved the issue for me.
Just submitted a pull request to fix this issue.
@asselin Nice, thanks!
@Deliaz I experience the same issue you mention. Have you found a fix or a workaround? I tryed the fixes sent by @asselin but no luck. Thanks
@Deliaz That may be a fix for those who use jQuery in their project. I am no so fortunate.
@angi- event.preventDefault()
is a pure JS way
@avilaton Does @Deliaz 's fix work for you? If so, what was the behavior you saw after applying my fix?
@angi- Ditto for my fix-- no jquery required
@asselin Yes, it does, under certain adaptations to an angular.js app. needsclick does not catch it, I had not time to see why, but the fix should be right there.
As OP said you can exclude selects from fastclick and then it's fine. I didn't manage to do that with "needsclick" class.
I had to add this to the FastClick.prototype.onTouchStart method in fastclick.js
if (targetElement.nodeName.toLowerCase() == "select") {
return false;
}
@oldboyxx thank you, this resolved my issue. I expanded upon it to include native datepickers in mobile scenarios.
var nodeName = targetElement.nodeName.toLowerCase();
var typeAttribute = targetElement.getAttribute('type');
if (nodeName === "select" || (typeAttribute === 'date' && nodeName === "input") || (typeAttribute === 'datetime' && nodeName === "input")) {
return false;
}
+1 having the same issue. Fixed nicely by solution from @oldboyxx - thank you very much.
You can use https://github.com/percolatestudio/fastclick/commit/9ac88ef4653cb1621644ce58080c0696ef9a6598
but return value should be false, as @optikalefx mentioned in that request
@contactmatts @oldboyxx Did you put either of your fixes up in a PR?
@davidnormo I did not.
+1 same issue. Made doubly worse it seems when using Angular or dynamicly added selects: the select was totally unselectable unless the user holds down on it for a second or so.
@oldboyxx fix worked for me:
https://github.com/ftlabs/fastclick/issues/268#issuecomment-65022184
Any reason this isn't taken in to the code as a patch (doubt anyone would care about a 300ms delay on selects on iOS)?
I'd like to add that the fix provided by @asselin (see pull request here) still is needed in 1.0.6. I added the code from that pull request to my local copy of 1.0.6 and everything is working great.
+1 to merging one of the fixes for this issue. Personally I went for the fix from @oldboyxx
This will be fixed in some version? I'm using this library but is really awful patch every update or new instalation.
As @laurentgoudet mentioned: Just revert this changes (use "!deviceIsIOS4" in the IF-Statement instead of "!deviceIsIOS") and you will be fine again! =) According to the current version you need to make the changes in the line 584 in fastclick.js . https://github.com/ftlabs/fastclick/pull/235/files
Or simply use my attached modified version =) . But pay attention that this breaks VoiceOver again in some way. fastclick.js.zip
The fix of @oldboyxx didn't work for me as it disabled fastclick.
Problem still occurs, @oldboyxx 's fix worked for me, thanks!
This isn't a fastclick issue. It happens in all browsers when RTL and the input is out of the viewport: See this: http://codepen.io/davidpelayo/full/jMjggy/
Tested on latest Firefox, latest Chrome stable and Safari on iOS 10.
+1 for fix by @oldboyxx
so this repo is broken and no plans to fix it i take it thne? this is still a problem years later
why would you use something that breaks any input on the page.. .stupid
The fix for the issue #226 is breaking the select inputs on iOS7 (tested on both iPhone 5 & 5s) for "quick" taps (faster than the 100ms threshold) when the position of the select element on the screen is moved up because the dropdown pops up at the bottom of the screen. If the touchend is not preventDefault(), the element under the initial position of the element (if any) will get the focus, closing the select dropdown.
See video here: http://youtu.be/0J_RNTMzHyQ Test file: http://pastebin.com/hqs3sDB4
If there are no focusable element under to initial on-screen position of the select input it will work fine, as well as if the select input in near the top of the screen and does not move when the dropdown pops up.
The only fixes I found are: