Skip to content

Ensure checkbox checked property stays synced across elements#1303

Open
brentswisher wants to merge 1 commit into
developfrom
fix/keep-checkbox-checked-property-in-sync
Open

Ensure checkbox checked property stays synced across elements#1303
brentswisher wants to merge 1 commit into
developfrom
fix/keep-checkbox-checked-property-in-sync

Conversation

@brentswisher

Copy link
Copy Markdown
Contributor

This change: (check at least one)

  • Adds a new feature
  • Fixes a bug
  • Improves maintainability
  • Improves documentation
  • Is a release activity

Is this a breaking change? (check one)

  • Yes
  • No

Is the: (complete all)

  • Title of this pull request clear, concise, and indicative of the issue number it addresses, if any?
  • Test suite(s) passing?
  • Code coverage maximal?
  • Changeset added?

What does this change address?
Closes #1302

How does this change work?
The input inside the checkbox was previously rendered with an attribute binding, ?checked=${this.checked}. Switching to a property binding wrapped in Lit's live() directive: .checked=${live(this.checked)} will ensure it stays in sync no matter if it is clicked or changes programmatically.

https://lit.dev/articles/lit-cheat-sheet/#attribute-and-property-expressions-(binding-syntax)

Additional context
Technically, just the property binding change would fix the initial bug report. Adding live() will ensure that the element can't get out of sync if something upstream catches the change event and cancels it. We set that event to be cancellable here to support links in the checkbox label, so this seemed the most complete way to ensure the checkbox remains in sync.

@brentswisher brentswisher requested a review from a team as a code owner June 12, 2026 21:36
@brentswisher brentswisher requested review from JimFeather, daneah and jialin-he and removed request for a team June 12, 2026 21:36
@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5a68d71

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
packages/pharos/lib/index.js 1.05 MB (+0.03% 🔺)

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.

Checkbox element input and web component checked property can become out of sync

2 participants