Skip to content

fix: preserve multi-select ComboBox selections for custom input#9945

Open
romansndlr wants to merge 2 commits intoadobe:mainfrom
romansndlr:fix-combobox-multi-custom-preserve-selection-9837
Open

fix: preserve multi-select ComboBox selections for custom input#9945
romansndlr wants to merge 2 commits intoadobe:mainfrom
romansndlr:fix-combobox-multi-custom-preserve-selection-9837

Conversation

@romansndlr
Copy link
Copy Markdown
Contributor

Summary

  • avoid clearing existing multi-select ComboBox values when allowsCustomValue commits or reverts custom input
  • keep the custom input text while closing the menu for Escape, Enter, and Tab
  • add a regression test covering the reported multi-select custom-value flow

Testing

  • yarn jest packages/react-aria-components/test/ComboBox.test.js packages/react-stately/test/combobox/useComboBoxState.test.js --runInBand
  • yarn eslint packages/react-stately/src/combobox/useComboBoxState.ts packages/react-aria-components/test/ComboBox.test.js

Closes #9837

Copy link
Copy Markdown
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, will see about having the team test it fully in a upcoming test session. We may want to coordinate the "commitBehavior" prop addition with this PR since the Tab behavior does feel a bit odd with multiple selection IMO but that should probably be up to user discretion.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ComboBox: selectionMode="multiple" + allowsCustomValue clears all selected keys on Escape, Enter, and Tab

2 participants