Skip to content

Fix select all in multi-select Select - #10977

Open
Bhavani2016 wants to merge 1 commit into
adobe:mainfrom
Bhavani2016:fix/select-all-10958
Open

Bhavani2016 wants to merge 1 commit into
adobe:mainfrom
Bhavani2016:fix/select-all-10958

Conversation

@Bhavani2016

Copy link
Copy Markdown
Contributor

Closes #10958

Summary

In a Select with selectionMode="multiple", pressing Cmd/Ctrl+A or calling selectionManager.selectAll() leaves the selection unchanged. Both actions produce the 'all' selection value, which useSelectState previously discarded.

Following the approach proposed by the issue reporter, useSelectState converts 'all' to the keys of the enabled options and passes them through the existing selection update. Users can then deselect individual options after selecting all.

📝 Test Instructions

  • Ran yarn test packages/react-aria-components/test/Select.test.js on the PR branch. All 40 tests passed.
  • The keyboard regression test failed before the fix because onChange received zero calls. It passed after the fix and confirmed that only the enabled options were selected.
  • The programmatic regression test confirmed that selectionManager.selectAll() selects the enabled options and that deselecting Cat leaves Dog selected. This test was verified after the fix.
  • Manually checked Cmd+A in local Storybook with selectionMode set to multiple on macOS. Ctrl+A was not manually tested on Windows or Linux.

Release impact

  • Only changes docs, tests, CI, or development tools. Nothing shipped to users changes.
  • Fixes a bug or improves existing code without changing how apps use it.
  • Adds a feature or API while keeping existing usage working.
  • May break existing usage or require changes in apps that use this code.

✅ PR Checklist

  • I followed the contributing guide.
  • I tested this change locally and included the results in Test Instructions, or explained why testing does not apply.
  • I understand and can explain every change in this PR. If I used AI assistance, I followed the AI contribution guidance.

I used ChatGPT to help investigate a issue

🧢 Your Project

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Select with selectionMode="multiple" ignores selectAll() and Cmd/Ctrl+A

1 participant