Skip to content

Fix CheckboxGroup form reset with multiple selections - #10686

Open
Bhavani2016 wants to merge 1 commit into
adobe:mainfrom
Bhavani2016:fix/checkbox-group-form-reset
Open

Bhavani2016 wants to merge 1 commit into
adobe:mainfrom
Bhavani2016:fix/checkbox-group-form-reset

Conversation

@Bhavani2016

Copy link
Copy Markdown

Closes #10643

When a form resets a CheckboxGroup with multiple selected values, one checkbox can remain selected. The goal is for every checkbox to return to the group's default selection.

removeValue previously calculated each removal from the values captured by the render. When multiple removals happen in the same update, a later removal can restore a value removed earlier. This change uses a functional state update so each removal sees the latest values.

The change adds a React Aria Components regression test for both CheckboxField and Checkbox, plus a React Stately test for multiple removals in one update.

AI assistance disclosure: I used ChatGPT to help investigate the issue

✅ 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
  • I understand every change in this PR and can explain why it's there.
  • If AI-assisted, I followed our AI contribution guidance and pointed my assistant at AGENTS.md.

📝 Test Instructions:

🧢 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.

CheckboxGroup form reset unchecks only one box again (regression of #7749)

1 participant