angular-dropdowns icon indicating copy to clipboard operation
angular-dropdowns copied to clipboard

Touch Issues

Open SimeonC opened this issue 10 years ago • 0 comments

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

SimeonC avatar Dec 01 '15 21:12 SimeonC