Skip to content

Conversation

@ValarMorghulis09
Copy link

Bug Description

In Listbox with multiple selection enabled and checkbox mode active,
the checkbox visual state could become out of sync with the actual selected
option state.

When clicking on the option label or the <li> element, the selection was
updated correctly, but the checkbox component could toggle independently,
leading to an inconsistent UI state.

Root Cause

p-checkbox was still handling its own internal toggle logic while the
Listbox component was also controlling selection state via option clicks.
This caused the checkbox to update separately from the Listbox selection
logic.

Fix

The checkbox is now marked as readonly to prevent it from managing its
own state. The Listbox remains the single source of truth for selection,
and the checkbox becomes a purely visual indicator of the selected state.

<p-checkbox
    ...
    [ngModel]="isSelected(option)"
    [readonly]="true"
    ...
>

Reproduction Steps

Use p-listbox with multiple="true" and checkbox="true"

Click on the option label or list item

Observe checkbox toggling independently of selection state

Affected Version

PrimeNG 18.x

Expected Behavior

Checkbox state should always stay in sync with the selected options.

@vercel
Copy link

vercel bot commented Jan 12, 2026

Someone is attempting to deploy a commit to the cetincakiroglu's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link

AI Code Review

Looks Good

Summary

Fixes checkbox toggle desync in Listbox by making checkboxes readonly, ensuring Listbox remains the single source of truth for selection state


This is an automated review. A maintainer will provide final approval.

No Linked Issue

This PR doesn't reference a GitHub issue. Please consider:

  • Linking to an existing issue with Fixes #xxx or Closes #xxx
  • Creating an issue first to document the problem/feature

This helps us track changes and maintain a clear history.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant