Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Dropdown menus don't get closed when selecting an option #4497

lrlopez opened this Issue · 20 comments

[Tested on Chrome 21, Safari 6 and Firefox 14]

I've upgraded Bootstrap on a test-branch and dropdown menus no longer close automatically once an option is selected. User has to click outside for the menu to disappear.

The problem is reproducible in the official docs:

Did I miss something on the changelog about this new behaviour? If this is a "WON'T FIX", is there any workaround to force them to close?


I have the same problem. Dropdowns used to close automatically when selecting an option, after upgrade to 2.1.0 they do not close anymore when an option is selected.


I have several dropdown into a navbar and it's always the first initialized who works well. Others do not want to close when I choose (click) an option OR if I click somewhere else on the page to close it.

The problem is here since the 2.1 version.



Same problem for me :


I've commented on the line of code that caused this here: c9cef74#js/bootstrap-dropdown.js. Change the target for the event to ".dropdown form" and it should be fixed.


@zachlowry This fixes the issue for me, thanks


Removing "form" from the selector also prevents menu items using rails jquery_ujs from working (e.g. :method => :delete for a sign out link).


+1 on this issue


+1 on this issue


Here's an interim solution until the 2.1.1 comes through:

  .off('click.dropdown', '.dropdown')
  .on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })

Edit: I should add, in case it's not clear, that this workaround is really only intended for those loading Bootstrap off a CDN. If you're hosting your own code, just fix it directly. :P


Thanks for the workaround!


+1 on this...


+1 for me too. Glad I'm not the only one that was confused.


I'm somewhat confused as to why 4756 was closed - the fix listed above does NOT fix that specific issue?

EDIT: Never mind, probably in reference to 4550

@fat fat closed this
@fat fat reopened this

added the form bit back, which fixes this – will look into another way of handling the mobile stuff

@fat fat closed this

@fat - I'm not seeing the commit in the Github commits that fixes this. Am I missing something?


Ahh, didn't realize that's how Twitter does it. Thanks!


A temporary workaround can be found here for incompatibilty with jquery-rails while waiting 2.1.1 release : seyhunak/twitter-bootstrap-rails#343

@skord skord referenced this issue in columbusrb/conclave

UI Enhancements #60

@skord skord referenced this issue in columbusrb/conclave

quick replies no longer quick #69


the same issue


$('.dropdown-menu select, .dropdown-menu textearea').click(function(e) {

@AramZS AramZS referenced this issue from a commit in PressForward/pressforward
@AramZS AramZS Setting up click to close for dropdowns
Another possible solution -
For #549
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.