adobe / adobe/react-spectrum

Shift+Up/Down shortcut to expand selection in grid list also captures Cmd+shift+Up/Down

Open
#6,904 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the issue here

We have a list with items. Each item can be selected to allow multiple items to be edited at the same time. If an item has focus, and the user presses `Shift+Up/Down`, the item above/below is included in the selection.

But we have are adding a separate keyboard shortcut for moving items to the top/bottom of the list using `Cmd+Shift+Up/Down`, but when that shortcut is pressed, `Shift+Up/Down` is also triggered by `react-aria`.

### 🤔 Expected Behavior?

I would expect that the keyboard shortcut isn't triggered if additional and unrelated modifier keys are pressed.

### 😯 Current Behavior

Current behavior is that the keyboard shortcut is triggered regardless of what additional modifier keys are pressed, as long as `shift+up/down` is pressed.

### 💁 Possible Solution

I suggest that if `cmd`/`ctrl`/`alt` keys are also pressed in addition to `shift`, the action is not triggered.

### 🔦 Context

_No response_

### 🖥️ Steps to Reproduce

The behavior can easily be tested in the first example on the `GridList` documentation page: https://react-spectrum.adobe.com/react-aria/GridList.html

Simply select an item, then press `Cmd+shift+up/down` to select items above/below. You can also test `shift+up/down` and/or `alt+shift+up/down` and all of these combinations behave the same.

### Version

react-aria/gridlist@3.8.1

### What browsers are you seeing the problem on?

Chrome

### If other, please specify.

All

### What operating system are you using?

Mac

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.