react-spectrum
react-spectrum copied to clipboard
feat: add `onKeyDown` prop to ListBoxItem for custom keyboard handling
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:
- Run Storybook:
yarn start - Navigate to "ListBox With Keyboard Delete" story
- Focus on an item and press Delete or Backspace
- Verify the item is removed and keyboard navigation still works
🧢 Your Project:
Open source contribution