Skip to content

feat: Keyboard shortcuts#10200

Open
snowystinger wants to merge 5 commits into
mainfrom
keyboard-shortcuts
Open

feat: Keyboard shortcuts#10200
snowystinger wants to merge 5 commits into
mainfrom
keyboard-shortcuts

Conversation

@snowystinger

@snowystinger snowystinger commented Jun 15, 2026

Copy link
Copy Markdown
Member

Closes

I think I've solved the chaining issue we had. By using chain, each handler is wrapped in it's own createEventHandler. This means that if any of the handlers or shortcuts call stopPropagation, it'll be stopped, same with preventDefault. They can't interfere with each other and the stricter behaviour wins. Stricter behaviour === stopping propagation and preventing of default.

In addition, I fixed a couple issues where I didn't quite translate the old behaviour correctly.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

  • Check that ComboBox can have the text cursor moved left/right and that arrow up on the first item or arrow down on the last causes the cursor to jump to the start or end of the input respectively
  • event chaining covered in tests
  • submenu's should continue to work
  • NumberField Enter can be used to submit

🧢 Your Project:

@rspbot

rspbot commented Jun 15, 2026

Copy link
Copy Markdown

@rspbot

rspbot commented Jun 15, 2026

Copy link
Copy Markdown
## API Changes

@react-aria/interactions

/@react-aria/interactions:KeyboardProps

 KeyboardProps {
+  allowComposing?: boolean
+  allowRepeats?: boolean
   isDisabled?: boolean
   onKeyDown?: (KeyboardEvent) => void
   onKeyUp?: (KeyboardEvent) => void
+  shortcuts?: KeyboardShortcutBindings
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants