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

feat: add `onKeyDown` prop to ListBoxItem for custom keyboard handling

Open hasegawa-101 opened this issue 4 weeks ago • 3 comments

Closes #8732

Added onKeyDown prop to ListBoxItem to support custom keyboard event handling for individual items, enabling features like deleting items with Delete/Backspace keys.

✅ Pull Request Checklist:

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

📝 Test Instructions:

  1. Run Storybook: yarn start
  2. Navigate to "ListBox With Keyboard Delete" story
  3. Focus on an item and press Delete or Backspace
  4. Verify the item is removed and keyboard navigation still works

🧢 Your Project:

Open source contribution

hasegawa-101 avatar Nov 13 '25 17:11 hasegawa-101