Skip to content

Conversation

@shantoislamdev
Copy link

Summary

Fix checkbox component to use .checked property instead of .value for correct boolean state binding.

Problem

The Lit checkbox incorrectly uses .value and evt.target.value:

Current (Bug) Expected
.value=${value} .checked=${value}
evt.target.value evt.target.checked
Returns string Returns boolean

Impact:

  • Checkbox doesn't display checked state visually
  • Event handler reads wrong property (always returns same string)
  • Data model receives string instead of boolean, corrupting state

Solution

Changed three lines in [renderers/lit/src/0.8/ui/checkbox.ts]

  1. Line 60: Updated method signature from string to boolean
  2. Line 96: Changed evt.target.valueevt.target.checked
  3. Line 100: Changed .value=${value}.checked=${value}

Evidence

The Angular checkbox implementation correctly uses:

  • [checked]="inputChecked()" (line 32)
  • event.target.checked (line 71)

See: [renderers/angular/src/lib/catalog/checkbox.ts]

Testing

  • npm install
  • TypeScript build (npx tsc -b) ✅
  • Tests pass: 23/23 ✅

Checklist

  • I have signed the Google CLA
  • My code follows the project's style guidelines
  • I have tested my changes locally

@google-cla
Copy link

google-cla bot commented Jan 9, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

The checkbox component incorrectly used .value (string) instead of
.checked (boolean) for both display binding and event handling:

- Changed .value=\ to .checked=\ for property binding
- Changed evt.target.value to evt.target.checked in event handler
- Updated #setBoundValue signature from string to boolean

This aligns the Lit implementation with the Angular reference
implementation and the A2UI protocol specification which states
checkbox value should be 'true for checked, false for unchecked'.
@shantoislamdev shantoislamdev force-pushed the fix/lit-checkbox-checked-property branch from d8f5315 to ab2eef7 Compare January 9, 2026 09:30
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.

1 participant