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

Touch Issues #70

Open
SimeonC opened this issue Dec 1, 2015 · 0 comments
Open

Touch Issues #70

SimeonC opened this issue Dec 1, 2015 · 0 comments

Comments

@SimeonC
Copy link

SimeonC commented Dec 1, 2015

Hi there, thanks for the directives.

I've been having issues with touch devices not closing the dropdown on select, it works fine on desktop browsers but it seems touch doesn't propagate the click event so I fixed the issue with the following code. Sorry I don't have time to make a proper PR.

this.select = function (selected) {
  if (selected !== $scope.dropdownModel) {
    angular.copy(selected, $scope.dropdownModel);
  }
  $scope.dropdownOnchange({
    selected: selected
   });
  DropdownService.toggleActive($element);
};

$element.bind('click', function (event) {
  // handle select toggles above in the select function
  var target = angular.element(event.srcElement || event.target);
  while (target[0] !== $element[0]) {
    if (target.hasClass('dropdown-item')) return;
    target = target.parent();
  }
  event.stopPropagation();
  DropdownService.toggleActive($element);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant