Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use correct value when resetting <Listbox multiple> and <Combobox multiple> #2626

Merged
merged 3 commits into from
Jul 28, 2023

Conversation

thecrypticace
Copy link
Contributor

Previously, when:

  1. Using either <Listbox multiple> or <Combobox multiple>; AND
  2. Having a default value set (e.g. defaultValue={['bob']}); AND
  3. The component was uncontrolled; AND
  4. It was in a <form> element; AND
  5. The user clicked the reset button

We would incorrectly push the array default value as an entry to the internal value array instead of replacing it. This fixes that problem.

Additionally, while working on this, we discovered that both uncontrolled <Listbox multiple> and <Combobox multiple> did not output form elements in Vue because they were incorrectly determined to be controlled. This PR fixes this as well.

Fixes #2603

@vercel
Copy link

vercel bot commented Jul 28, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 28, 2023 3:42pm
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 28, 2023 3:42pm

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.

Reset Multi-mode Listbox (React)
1 participant