Skip to content

[checkbox] Fix parent group cancellation and indeterminate state#4941

Open
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:codex/checkbox-parent-cancel-validation
Open

[checkbox] Fix parent group cancellation and indeterminate state#4941
atomiks wants to merge 1 commit into
mui:masterfrom
atomiks:codex/checkbox-parent-cancel-validation

Conversation

@atomiks
Copy link
Copy Markdown
Contributor

@atomiks atomiks commented May 29, 2026

This fixes Checkbox and CheckboxGroup edge cases where internal handling could continue after a canceled change, or manually indeterminate parent checkboxes could expose the wrong state.

Changes

  • Let onCheckedChange cancellation run before CheckboxGroup parent/child handling.
  • Keep parent-enabled group state unchanged when a parent or child change is canceled.
  • Apply manual parent indeterminate state to ARIA and the hidden input state.
  • Tighten parent-group tests so child checkbox assertions do not silently skip the default span root.

Original findings addressed

  • [P1] Parent checkboxes could be visually mixed while exposing aria-checked="false".
  • [P2] eventDetails.cancel() was too late for parent-enabled CheckboxGroup changes.
  • [P2] Parent-group tests had no-op child assertions.

@atomiks atomiks added type: bug It doesn't behave as expected. component: checkbox Changes related to the checkbox component. component: checkbox group Changes related to the checkbox group component. labels May 29, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 29, 2026

commit: 5356871

@code-infra-dashboard
Copy link
Copy Markdown

code-infra-dashboard Bot commented May 29, 2026

Bundle size

Bundle Parsed size Gzip size
@base-ui/react 🔺+39B(+0.01%) 🔺+19B(+0.01%)

Details of bundle changes

Performance

Total duration: 1,131.04 ms -205.69 ms(-15.4%) | Renders: 50 (+0) | Paint: 1,701.59 ms -331.97 ms(-16.3%)

Test Duration Renders
Slider mount (300 instances) 156.55 ms ▼-64.03 ms(-29.0%) 3 (+0)
Checkbox mount (500 instances) 61.16 ms ▼-25.90 ms(-29.8%) 1 (+0)

10 tests within noise — details


Check out the code infra dashboard for more information about this PR.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 29, 2026

Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 5356871
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6a196a68731ac20008cf947f
😎 Deploy Preview https://deploy-preview-4941--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks atomiks force-pushed the codex/checkbox-parent-cancel-validation branch from 8c907e5 to 75a45cc Compare May 29, 2026 10:21
@atomiks atomiks force-pushed the codex/checkbox-parent-cancel-validation branch from 75a45cc to 5356871 Compare May 29, 2026 10:28
@atomiks atomiks changed the title [checkbox] Fix parent group cancellation and validation [checkbox] Fix parent group cancellation and indeterminate state May 29, 2026
@atomiks atomiks marked this pull request as ready for review May 29, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: checkbox group Changes related to the checkbox group component. component: checkbox Changes related to the checkbox component. type: bug It doesn't behave as expected.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant