Skip to content

Commit

Permalink
listen to touchstart for dropdowns on mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
fat committed Aug 19, 2012
1 parent 45dddc5 commit c9cef74
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions docs/assets/js/bootstrap-dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@

$(function () {
$('html')
.on('click.dropdown.data-api', clearMenus)
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
$('body')
.on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })

This comment has been minimized.

Copy link
@zachlowry

zachlowry Aug 23, 2012

It looks like '.dropdown form' was changed to '.dropdown', which causes all of the items in the dropdown to not close when clicked. Is there a reason for this?

This comment has been minimized.

Copy link
@natansh

natansh Aug 23, 2012

Contributor

This is related to issue #4497

This comment has been minimized.

Copy link
@fat

fat Aug 28, 2012

Author Member

the reason this was done was for mobile reasons - without this, you can't select any element in a dropdown

.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
})

}(window.jQuery);
8 changes: 4 additions & 4 deletions docs/assets/js/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,11 @@

$(function () {
$('html')
.on('click.dropdown.data-api', clearMenus)
.on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus)
$('body')
.on('click.dropdown', '.dropdown form', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown', function (e) { e.stopPropagation() })
.on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle)
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown)
})

}(window.jQuery);/* =========================================================
Expand Down
Loading

0 comments on commit c9cef74

Please sign in to comment.