Skip to content

fix(react-aria-components): inherit CheckboxGroup validationBehavior (#10856) - #10860

Merged
yihuiliao merged 12 commits into
adobe:mainfrom
mangeshraut712:fix/checkboxgroup-aria-validation-behavior
Nov 6, 2026
Merged

yihuiliao merged 12 commits into
adobe:mainfrom
mangeshraut712:fix/checkboxgroup-aria-validation-behavior

Conversation

@mangeshraut712

Copy link
Copy Markdown
Contributor

Summary

Inside a CheckboxGroup, useCheckboxAria was defaulting validationBehavior to 'native'. That overrode a group-level setting such as validationBehavior="aria", because useCheckboxGroupItem only inherits the group's value when the checkbox leaves validationBehavior undefined.

Fix

When checkbox group state is present, leave validationBehavior undefined unless the checkbox (or form context) sets it explicitly, so the group setting is inherited.

Test plan

  • Added regression: group validationBehavior="aria" + isRequired → checkbox has no required attr and form.checkValidity() is true
  • Existing CheckboxGroup validation tests still pass

Fixes #10856

Inside a CheckboxGroup, useCheckboxAria was defaulting validationBehavior
to 'native', which overrode the group's setting (e.g. "aria") because
useCheckboxGroupItem only falls back when the value is undefined.

Leave validationBehavior undefined when group state is present so the
group-level setting is inherited. Fixes adobe#10856.
Comment on lines +349 to +351
// Regression for #10856: a group-level aria validationBehavior must reach
// each checkbox. With the buggy 'native' default on useCheckboxAria, the
// checkbox keeps required and form.checkValidity() blocks submit.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

remove pls.

@nwidynski

Copy link
Copy Markdown
Contributor

Otherwise LGTM

// Standalone checkboxes default to native validation. Inside a CheckboxGroup,
// leave validationBehavior undefined so useCheckboxGroupItem inherits the
// group's setting (e.g. validationBehavior="aria" on the group).
let validationBehavior =

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Generally I think this seems okay but let's say you have a CheckboxGroup with validationBehavior='aria' inside a RAC Form, the formValidationBehavior will take precedence and by default, it always sets validationBehavior to native.

The test pass because it's inside a <form> but if you were to use RAC <Form>, it would fail.

I think the check should be something like this

let validationBehavior =
  props.validationBehavior ??
  (groupState ? undefined : (formValidationBehavior ?? 'native'));

@yihuiliao yihuiliao added the waiting on author Waiting on Issue Author label Oct 28, 2026
@yihuiliao yihuiliao removed the waiting on author Waiting on Issue Author label Nov 3, 2026
@yihuiliao yihuiliao added the waiting on author Waiting on Issue Author label Nov 4, 2026
@snowystinger snowystinger removed the waiting on author Waiting on Issue Author label Nov 6, 2026

@snowystinger snowystinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

thanks for the updates

@yihuiliao yihuiliao added the no testing Does not require manual testing during testing session label Nov 6, 2026
@yihuiliao
yihuiliao added this pull request to the merge queue Nov 6, 2026
Merged via the queue into adobe:main with commit 82959b6 Nov 6, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Checkbox no testing Does not require manual testing during testing session RAC ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CheckboxGroup: validationBehavior="aria" is ignored by its checkboxes since 1.18

4 participants