adobe / adobe/react-spectrum

ListView Drag and Drop "link" behavior using Ctrl or Alt as modifier key does not work with keyboard

Open
#4,218 3 comments 0 reactions 0 assignees View on GitHub
accessibility bug drag and drop
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

# 🐛 Bug Report

Using the [ListView Drag and Drop -- draggable rows allow copy and link Storybook Story](https://reactspectrum.blob.core.windows.net/reactspectrum/41e26fa0f01ee9ab6e5c21edf6f7bb5d498bf40f/storybook/index.html?path=/story/listview-drag-and-drop--draggable-rows-allow-copy-and-link&providerSwitcher-express=false&providerSwitcher-toastPosition=bottom), after selecting an item to drag using the keyboard and moving keyboard focus the drop target, try to drop as a link using Alt+Enter on Windows/Control+Enter on macOS keyboard combination.

## 🤔 Expected Behavior

Drag and Drop should fire events to complete a `dropOperation: "link"` on the drop target `onDrop`, `dragEnd`, `onDropExit`.

## 😯 Current Behavior

Drag and Drop only allows `copy` or `cancel` drop operations, `Alt+Enter` triggers the `DragSession.activate()` method, while `Ctrl+Enter` triggers a `copy` drop operation rather than a `link`.

## 💁 Possible Solution

We need to determine the allowed drop operations when the Enter key is pressed using a modifier on a drop target, here:
https://github.com/adobe/react-spectrum/blob/e044ef71a2c3fc0b1ba67dcb47fa581073cf07ad/packages/%40react-aria/dnd/src/DragManager.ts#L217-L248

## 🔦 Context

FY23 Accessibility Audit

## 💻 Code Sample

## 🌍 Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| react-spectrum | @adobe/react-spectrum@3.25.1
| Browser | Chrome Version 111.0.5563.64 (Official Build) (arm64)
| Operating System | macOS Ventura 13.2.1 (22D68)

## 🧢 Your Company/Team

## 🕷 Tracking Issue (optional)

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.