Skip to content

chore: fix Checkbox indeterminate state#7780

Open
francinelucca wants to merge 8 commits intomainfrom
chore/checkbox-indeterminate-fix
Open

chore: fix Checkbox indeterminate state#7780
francinelucca wants to merge 8 commits intomainfrom
chore/checkbox-indeterminate-fix

Conversation

@francinelucca
Copy link
Copy Markdown
Member

@francinelucca francinelucca commented Apr 27, 2026

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

  • Updated the handleOnChange event handler in Checkbox.tsx to explicitly reset the indeterminate property and the 'aria-checked' attribute to 'mixed' after a change event, preventing the indeterminate state from being lost on click.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

Copilot AI review requested due to automatic review settings April 27, 2026 15:39
@francinelucca francinelucca requested a review from a team as a code owner April 27, 2026 15:39
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 27, 2026

🦋 Changeset detected

Latest commit: 9b64f34

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

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

@github-actions github-actions Bot added the staff Author is a staff member label Apr 27, 2026
@github-actions github-actions Bot added the integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm label Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

⚠️ Action required

👋 Hi, this pull request contains changes to the source code that github/github-ui depends on. If you are GitHub staff, test these changes with github/github-ui using the integration workflow. Check the integration testing docs for step-by-step instructions. Or, apply the integration-tests: skipped manually label to skip these checks.

To publish a canary release for integration testing, apply the Canary Release label to this PR.

@francinelucca francinelucca added the Canary Release Apply this label when you want CI to create a canary release of the current PR label Apr 27, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 useIsomorphicLayoutEffect that sets checkboxRef.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

Comment thread packages/react/src/Checkbox/Checkbox.tsx Outdated
Comment thread packages/react/src/Checkbox/Checkbox.tsx Outdated
@github-actions github-actions Bot requested a deployment to storybook-preview-7780 April 27, 2026 15:45 Abandoned
@github-actions github-actions Bot temporarily deployed to storybook-preview-7780 April 27, 2026 15:57 Inactive
Comment thread .changeset/proud-bears-study.md Outdated
Co-authored-by: Josh Black <joshblack@github.com>
@github-actions github-actions Bot temporarily deployed to storybook-preview-7780 April 27, 2026 17:10 Inactive
@primer-integration
Copy link
Copy Markdown

⚠️ Hi from github/github-ui! The integration workflow could not find a canary version for the latest commit on this PR.

A successful canary CI run (i.e., a valid canary version published via the release.yml workflow) must exist for the latest commit before integration checks will succeed.

Next steps:

  1. Make sure the Canary Release label is applied to the PR — the release.yml workflow requires this label to publish a canary version.
  2. Wait for the release.yml canary CI run to complete successfully for the latest commit on this PR.
  3. Once a valid canary version exists, re-trigger the integration workflow by visiting the primer-react-pr-test workflow page, clicking Run workflow, and pasting this PR's URL.

For more details, see this workflow run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Canary Release Apply this label when you want CI to create a canary release of the current PR integration-tests: recommended This change needs to be tested for breaking changes. See https://arc.net/l/quote/tdmpakpm staff Author is a staff member

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants