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

Modal, Dropdown does not work properly on mobile devices #5094

Closed
sam6230i opened this issue Sep 12, 2012 · 15 comments
Closed

Modal, Dropdown does not work properly on mobile devices #5094

sam6230i opened this issue Sep 12, 2012 · 15 comments
Labels

Comments

@sam6230i
Copy link

Modal and Dropdown opens up without any error but the elements inside it are not actionable on mobile devices. I mean in case of Dropdown clicking on options, Dropdown disappears but the action is not getting performed. And in case of Modal its not allowing me to click on the elements inside it. Basically Dropdown and Modal both are completely unusable on mobile device (on web it works well). Even Modal and Dropdown inside Bootstrap main site also does not work for me. I am testing on default browser for android

@wyred
Copy link

wyred commented Sep 12, 2012

Same problem on iOS's Safari browser on iPhone and iPad. Dropdown menu opens fine but cannot be tapped on.
I believe it used to work fine until recent updates (possibly 2.1.0)

@sam6230i
Copy link
Author

I am facing this problem with their recent release 2.1.1 too

@sam6230i sam6230i reopened this Sep 13, 2012
@thezoggy
Copy link

but what about 2.1.2 ?

@blakeembrey
Copy link
Contributor

Easily fixed by adding:

$('body').on('touchstart.dropdown', '.dropdown-menu', function (e) { e.stopPropagation(); });

This fix is incorporated into #5067 - basically stops the touch event on a dropdown from bubbling to the next element, which would be the HTML tag and has the clearMenus function.

@blakeembrey
Copy link
Contributor

Could also do a check inside the clearMenus function. Something like?

function clearMenus(e) {
  if (e && typof e === 'object' && e.type === 'touchstart') {
    if ($(this).closest('.dropdown-menu').length) { return; }
  }
  ...
}

However, this would be more expensive and only result in the advantage of being able to bind dropdown menu touch events to the html tag.

P.S. This code snippet is untested but should work fine.

@giolvani
Copy link

The suggest of @blakeembrey solve my problem about Dropdown...

Thanks

@tofumedia
Copy link

Thanks @blakeembrey my dropdown menu items are clickable on the iphone now

@mdo
Copy link
Member

mdo commented Nov 4, 2012

Closing this as a dupe of #5094, which also reports the same dropdown issues. Hoping to have a fix in 2.2.2-wip.

@mdo mdo closed this as completed Nov 4, 2012
@pseps
Copy link

pseps commented Nov 8, 2012

@blakeembrey, thanks for the fix. Sorry for the newbie question, but where do you add it?

@blakeembrey
Copy link
Contributor

@pseps Both the snippets I posted modify the bootstrap-dropdown.js file.

@pseps
Copy link

pseps commented Nov 9, 2012

@blakeembrey Thanks!

1 similar comment
@atherdon
Copy link

@blakeembrey Thanks!

@jasonhoi
Copy link

@blakeembrey Yo!!! You are my friend saving me a day of life!

@ds125v
Copy link

ds125v commented Nov 22, 2012

Am I being dense or was this bug closed as a duplicate of itself? Was it a typo and there's another bug out there that I should be following for a fix to this?

@duvtedudug
Copy link

Sorry how exactly do I incorporate blakeembrey's fix? I'm a numbskull.

@twbs twbs locked and limited conversation to collaborators Jul 28, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests