Button dropdown links don't work on mobile (android, iOS)
I have simple dropdown buttons we built with 2.04
links are A tags, proper quotes, href='#'
Used to work fine.
Upgraded today to 2.1 and the links in any dropdown button don't work. The dropdown menu opens, but clicking on a link closes the menu without any action. tested on Android 2.3 and iOS 5
Rolledback to 2.04 and everything works again. Anyone else has this issue?
Same problem here for me. Menu opens, but clicking simply close it. Tested on iPad IOS 5.1
Would like to add that the dropdown menus from a navbar do work on a iPad (iOS 6), but like the other 2 posters they are not working on a dropdown button.
A quick hack to prevent the dropdown menu from being cleared on touch devices:
on line 143 of bootstrap-dropdown.js replace
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
with
.on('click.dropdown.data-api', clearMenus)
You won't be able to tap outside the menu to close it, but the dropdown links will work.
+1
Looking forward to the fix in 2.1.1
Hey @MikiMullor,
Thanks for opening this issue! Unfortunately, it looks like it fails to pass the criteria neccessary for submitting to bootstrap. The following things are currently failing:
- should include a jsfiddle/jsbin illustrating the problem if tagged with js but not a feature
For a full list of issue filing guidelines, please refer to the bootstrap issue filing guidelines.
thanks!
@fat
This seems counter-productive. The issue can be repeated on the bootstrap sample page, and it's pretty critical that Bootstrap button dropdown links don't work on touch devices! :-/
If it means getting it fixed in 2.1.1, Here's a JSFiddle
@ShivX thanks!
+1 here.
Looking forward to the fix. Any foreseeable release date for it?
Edit: For those interested, this is my little "workaround" that seems to work, add it after the "bootstrap-dropdown.js" include (I put mine in the $(function() { } section which is located at the end of the page in my case):
$('a.dropdown-toggle').on('touchstart', function(e) {
// do your stuff here
})
Still an issue in 2.1.1. Demo can be found in gh-pages.
Have also tested with 2.1.1. Dropdown menu links do not work on IOS devices running 5.1.1. They work fine when using RWD Bookmarklet or responsive.is for testing, just not natively on IOS devices.
I'm having this issue too. Very much interested in a fix.
Having the issue in Chrome Desktop with v.2.1.1 @dpwolf solution worked for us (aka removing touchstart event in that line).
The problem is that both events 'click' and 'touchstart' are triggered. First "touchstart" event and then, 300 ms later comes up the 'click' event .. so clearMenu is called twice.
Probably I'm wrong.. but it's like the browser doesn't have time to handle the 'a' link as normally because touchstart already cleared the menus.
Is there any other solution than treat those 2 event types separetly ? More info https://developers.google.com/mobile/articles/fast_buttons?hl=de-DE
Same problem for me with Bootstrap 2.1.1 on iOS 6 :-(
I'm experiencing this issue as well :(
Pull #4812 looks to address this
Pull #4812 didn't fix dropdown links on iOS for me. It seems the default event is still being prevented.
Also have this problem on IOS 6.
I'll fix this up in my PR later today. Shouldn't require too much of a change to get this working as expected.
I seem to have a better workaround by adding this line after the line dpwolf mentioned, rather than changing the line:
$('.dropdown-menu').on('touchstart.dropdown.data-api', function(e) { e.stopPropagation() })
I haven't noticed any side effects so far.
@fridgesm Pretty much the same thing I did for my fix in #5067 - However you should bind it to the body otherwise it won't get triggered on any dropdowns after you call that line. Should be a better solution to this, just can't think of on right now