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

make ListCollection and TreeCollection satisfy the Collection interface

Open nishitaniyuki opened this issue 9 months ago • 0 comments

Currently, ListCollection and TreeCollection does not satisfy the Collection interface, because getKeyBefore() and getKeyAfter() could return undefined. The details are as follows.

Collection interface:

ListCollection:

TreeCollection:

For example, if we replace state.collection.getKeyAfter(item.key) == null in useDraggableCollection() docs with state.collection.getKeyAfter(item.key) === null, things does not work as expected (according to the type definition this is valid).

✅ 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:

🧢 Your Project:

nishitaniyuki avatar May 14 '24 07:05 nishitaniyuki