Skip to content

fix(SelectionManager): support full collection for select all functionality#9621

Open
reidbarber wants to merge 2 commits intomainfrom
selectionmanager-fullcollection
Open

fix(SelectionManager): support full collection for select all functionality#9621
reidbarber wants to merge 2 commits intomainfrom
selectionmanager-fullcollection

Conversation

@reidbarber
Copy link
Member

@reidbarber reidbarber commented Feb 6, 2026

Closes #9620

When you had a collection with 'all' selected inside an Autocomplete, then filtered down the collection and toggled an item, the 'all' selection internally was only including filtered items' keys, so you'd lose selection for all non-visible items.

This adds a fullCollection field so we can still access the unfiltered collection when toggling selection.

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

Test new story:

  1. Filter down the list by typing 'ba'
  2. De-select one of the options
  3. Clear the field
  4. 'Foo' should still be selected

@rspbot
Copy link

rspbot commented Feb 6, 2026

Copy link
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to work well for fixed collections, but what do you think about async loaded items or if the wrapped collection has controlled items (i.e. the filtering is handled externally and items constantly changes causing fullCollection to change)? I suppose for that case it would reasonable to expect selected keys to be tracked outside the component itself?

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.

Multiple selection components with autocomplete lose selection state

3 participants