Skip to content
This repository was archived by the owner on May 29, 2019. It is now read-only.

Fix dropdown auto close in mobile phones for angular ~1.4.7 #4643

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])

this.open = function(dropdownScope) {
if (!openScope) {
$document.bind('touch', closeDropdown);
$document.bind('click', closeDropdown);
$document.bind('keydown', keybindFilter);
}
Expand All @@ -23,6 +24,7 @@ angular.module('ui.bootstrap.dropdown', ['ui.bootstrap.position'])
this.close = function(dropdownScope) {
if (openScope === dropdownScope) {
openScope = null;
$document.unbind('touch', closeDropdown);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job on remembering this - it's REALLY easy to forget to do.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I close it because I realize that the thing that was wrong and nonfunctional were the $document.bind (mobilephone) in angular ~1.4.7 so my code does not fix anything... I am looking what is going on.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problems seems to happend only in elements with ng-click attribute and with ngTouch enabled

$document.unbind('click', closeDropdown);
$document.unbind('keydown', keybindFilter);
}
Expand Down