chore: fix Checkbox indeterminate state#7780
Conversation
🦋 Changeset detectedLatest commit: 9b64f34 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
There was a problem hiding this comment.
Pull request overview
Updates the Checkbox component so the indeterminate state is re-applied after every render, improving reliability of the underlying input’s indeterminate DOM property.
Changes:
- Removed the dependency array from the
useIsomorphicLayoutEffectthat setscheckboxRef.current.indeterminate.
Show a summary per file
| File | Description |
|---|---|
| packages/react/src/Checkbox/Checkbox.tsx | Ensures indeterminate is applied on every render by running the layout effect without a dependency array. |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 2
…react into chore/checkbox-indeterminate-fix
Co-authored-by: Josh Black <joshblack@github.com>
|
A successful canary CI run (i.e., a valid canary version published via the Next steps:
For more details, see this workflow run. |
This pull request addresses a bug in the Checkbox component's handling of the indeterminate state. Previously, clicking the checkbox could cause the indeterminate state to be lost if the state did not change. The update ensures that the indeterminate state is consistently maintained after user interaction.
Before:
Screen.Recording.2026-04-27.at.11.42.17.AM.mov
After:
Screen.Recording.2026-04-27.at.12.21.04.PM.mov
Changelog
Changed
handleOnChangeevent handler inCheckbox.tsxto explicitly reset theindeterminateproperty and the'aria-checked'attribute to'mixed'after a change event, preventing the indeterminate state from being lost on click.Rollout strategy
Testing & Reviewing
Merge checklist