-
-
Notifications
You must be signed in to change notification settings - Fork 79k
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
Javascript Data-API always attaches click events (when touch events are preferred for mobile) #2654
Comments
I know in my recent pull request #2640 for carousel swiping that touch support really doesn't have to be that hard. It most likely would just involve checking for common touch events and having them call existing functions as I did with carousel. Could you give me some examples of which components you are running into this with and also feel free to try out my changes to carousel at bootstrap.simplydev.com. would be great to get some feedback on various touch devices. |
The reason I ask for examples is because from what Adobe has pointed out in this doc.
http://help.adobe.com/en_US/as3/dev/WSb2ba3b1aad8a27b0-6ffb37601221e58cc29-8000.html |
I should note that most of the additional load would come from supporting multi-touch and such. I believe from what I have picked up playing with carousel that each time you listen for gestures you have to handle 3 different events which is where performance can take a hit. |
I am using the modals in my mobile app, and that's where I had to make the touch/click modification. The complex part for my code is that I don't actually use touch for everything - there are some places where I choose to use click instead, depending on how well touch works or doesn't work (mostly due to Android Webkit quirkiness). So I have wrapper functions that either always assign a click handler, or that assign a touch handler or a click handler, if touch is supported. I think I'm currently using click for modals after testing how touch worked, actually, but I needed the flexibility of checking which one works better. So in conclusion: my use case is complex. Hopefully others arent as complex. And this all should get better. Once Android stops being the worst Webkit ever. |
gotcha, it would be kinda interesting to maybe implement touch as a plugin, kind of how transitions work but make it check for mobile being included and run data api stuff from it vs standard. that way nothing existing breaks but if someone has true mobile needs then its just another include for advanced use cases. |
Well you can turn off the data click api (without having to comment anything out like this): $('body').off('.data-api') that will remove all click events. I'll start thinking about a better solution for you mobile nerds though :) |
Hey @pamelafox, Thanks for opening this issue! Unfotunately, it looks like it fails to pass the tests neccessary for submitting to bootstrap. The following tests are currently failing:
For a full list of issue filing guidelines, please refer to the bootstrap issue filing guidelines. thanks! |
I use Twitter Bootstrap for both the web and mobile app versions of my site. The JS data API works great on the web, but when I ported it to mobile, I realized that it uses click events for everything - and touch events are the preferred mode of interaction on mobile apps.
I ended up having to comment out the data-API bit and re-write it using touch events in my mobile code.
Touch events are pretty tricky and developers use multiple libraries for dealing with them, so I'm not sure if Bootstrap wants to tackle the issue. But maybe there's a smart way that Bootstrap can let developers use the data API with their preferred "click mechanism". Something to think about, at least.
The text was updated successfully, but these errors were encountered: