angular-ui / ui-grid

UI Grid: an Angular Data Grid
http://ui-grid.info
MIT License
5.39k stars 2.47k forks source link

ui-grid header sort hit/miss on Windows 8.x touch devices #5319

Open yogeshgadge opened 8 years ago

yogeshgadge commented 8 years ago

Steps to reproduce

  1. On Windows 8.1 tablet go to using ui-grid.info/ on Edge (Internet Explorer) or even Internet Explorer 11.
  2. Scroll below to the Basic Example.
  3. Click on any of the headers to sort (not the column menu)

    Observed behavior

After a few touch (or even the first header touch) sorting is not working. Its a hit or miss.

Expected behavior

On touching the header each time it should work.

Additional Info

If a user tries to drag a column it works.

yogeshgadge commented 8 years ago

Seems to me that in some browsers touchend is not firing or there is a delay. But touchmove seems fine which is doing the trick.

yogeshgadge commented 8 years ago

The issue happens whenever I get an actual click event is generated. Following code fixes the problem.

          $scope.offAllEvents();
          if ( event.type === 'touchstart'){
            $document.on('touchend', $scope.upFn);
            $document.on('touchmove', $scope.moveFn);
          } else if ( event.type === 'mousedown' ){
            //Fix listen to even on the element
            $contentsElm.on('mouseup', $scope.upFn);
            //This never got fired
            //$document.on('mouseup', $scope.upFn);
            $document.on('mousemove', $scope.moveFn);
          }