Skip to content

Touch Issues #70

Description

@SimeonC

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);
});

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions