react-spectrum icon indicating copy to clipboard operation
react-spectrum copied to clipboard

Handle left click + ctrl key in usePress

Open hipstersmoothie opened this issue 2 years ago • 3 comments

To trigger context menus you can either

  • right click
  • hold ctrl and click

The usePress hook wasn't handling the second case.

hipstersmoothie avatar Oct 10 '23 18:10 hipstersmoothie

Interesting. Given the specs and OS behaviors does it make sense?

hipstersmoothie avatar Oct 11 '23 16:10 hipstersmoothie

I'll have to see where we got "should toggle items in selection highlight with ctrl-click on Mac" https://github.com/adobe/react-spectrum/blob/main/packages/%40react-spectrum/list/test/ListView.test.js#L1016

Because I tried out Ctrl + Click on https://react-spectrum.adobe.com/react-spectrum/ListView.html#highlight-selection and the context menu came up and it didn't toggle the selection if I had everything already selected. But it did with the CMD key.

So I'm thinking a wire got crossed somewhere.

snowystinger avatar Oct 11 '23 19:10 snowystinger

Hey, we were discussing this a bit more today and none of us know where the context menu isn't working for that second case. Could you provide step by step instructions including a link to the component which you are trying this on? For instance, we tried opening https://react-spectrum.adobe.com/react-spectrum/Button.html#example and Ctrl+Clicking on this button and we see a context menu.

I've fixed up our tests to be a little more accurate Fix ListView tests for highlight + modifier keys

snowystinger avatar Oct 12 '23 20:10 snowystinger

Closing as stale.

devongovett avatar Apr 12 '25 00:04 devongovett