dgrid icon indicating copy to clipboard operation
dgrid copied to clipboard

Selection cleared when right-clicking on OSX+trackpad

Open dmartin-gh opened this issue 9 years ago • 0 comments

This can only be reproduced on OSX with a trackpad. The steps are:

  1. Make a ranged selection.
  2. Use ctrl+trackpad click to call the oncontextmenu handler on one of the selected rows. You must hold down the trackpad button.
  3. Move the cursor off the browser context menu (or Dijit menu).
  4. Release the trackpad button so that the grid receives the mouse-up event.

The mouse-up event will clear the ranged selection because it is not treated as a right-click by _extendedSelectionHandler.

This becomes troublesome when using a Dijit menu per row, because the selection will get cleared depending on where the menu is rendered relative to the cursor:

  • If Dijit detects that it can render the menu below the cursor, the top-left corner of the menu will be rendered under the cursor (just barely) and the mouse-up event will not fall through to the grid. If the user moves their cursor slightly between mouse-down and mouse-up so that the cursor ends up not over the edge of the menu, the selection is cleared.
  • If the menu is rendered above the cursor because it is close to the bottom of your screen, the cursor will not be over the menu and the mouse-up event will fall through.

This gives our users the impression that the grid is clearing their ranged selection at random when attempting to open the right-click menu, unless they figure out this nuance.

Reproduction: http://jsfiddle.net/ncppy6ex/3/ Possible fix: https://gist.github.com/dmartinzar/b18da3ddb81dd3cd6cab

The gist above teaches the _extendedSelectionHandler how to correctly identify right-clicks on OSX trackpads and treat them like event.button === 2.

dmartin-gh avatar Feb 15 '16 21:02 dmartin-gh