adobe / adobe/react-spectrum

onCancel should fire in AlertDialog if Escape is pressed

Open
#1,773 7 comments 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

# 🐛 Bug Report (or maybe feature request?)

When adding an `onCancel` handler to an AlertDialog, it should fire if the dialog is closed via the Escape key.

See here for a repro: https://codesandbox.io/s/adoring-meadow-7cl4c?file=/src/App.js

Open the dialog, click Cancel, dialog will close, you'll see 'Canceled' in the console.
Open the dialog, press Escape key, dialog will close, no 'Canceled' in the console.

Contributor guide

Open the contributing guide

Research direction

Start with the reproduction in src/App.js from the linked CodeSandbox and trace the AlertDialog Escape-key dismissal path. Confirm that closing with Escape invokes onCancel and that the existing click-Cancel behavior still logs “Canceled”.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
accessibility, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.