Skip to content

fix(uve): scope radio and checkbox inputs by field variable name#35433

Merged
zJaaal merged 7 commits intomainfrom
fix/uve-radio-checkbox-name-binding
Apr 23, 2026
Merged

fix(uve): scope radio and checkbox inputs by field variable name#35433
zJaaal merged 7 commits intomainfrom
fix/uve-radio-checkbox-name-binding

Conversation

@zJaaal
Copy link
Copy Markdown
Member

@zJaaal zJaaal commented Apr 23, 2026

Summary

  • Radio buttons and checkboxes in the UVE quick-edit form were sharing the same browser input group across different fields, causing selections in one field to affect another
  • Added [name]="field.variable" to p-radioButton and p-checkbox in the @for loop so each field's inputs are scoped independently by their unique variable name

Closes #35432

Test plan

  • Open UVE and click a contentlet with multiple Radio fields — selecting an option in one field should not affect another
  • Open UVE and click a contentlet with multiple Checkbox fields — checking/unchecking in one field should not affect another
  • Verify single-option binary checkboxes still work correctly

🤖 Generated with Claude Code

Add [name]="field.variable" to p-radioButton and p-checkbox in the
quick-edit form so each field's inputs are grouped independently.
Without this binding PrimeNG shares a single internal name across all
fields, causing selections in one field to affect another.

Closes #35432

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude Bot commented Apr 23, 2026

Claude finished @zJaaal's task in 1m 0s —— View job


PR Review

  • Read changed files
  • Review HTML template changes
  • Review test changes
  • Post findings

HTML change — correct and minimal. field.variable is already the reactive form key, so it's guaranteed unique within the form; using it as the name attribute is the right choice.

One thing to flag in the tests:

The behavioral isolation tests (form.get('sizes')?.value, form.get('status')?.value) verify Angular reactive-form isolation — but that layer was never broken. Each formControl is keyed by field.variable regardless of the HTML name attribute, so those assertions would pass even on the unfixed code.

The actual bug was browser-native visual grouping: two radio/checkbox groups sharing the same name in the DOM, so clicking one field's option would visually deselect another field's option. The regression tests that actually cover this are the getAttribute('name') assertions in the it.each blocks — those are the meaningful guards for this fix.

The isolation tests aren't wrong, they just don't prove what their comments imply. Not blocking, but a future reader might draw incorrect conclusions from the test descriptions.

Otherwise clean.

zJaaal and others added 2 commits April 23, 2026 11:51
Extend the [name]="field.variable" fix to the binary p-checkbox branch.
Without it, two binary checkbox fields could share PrimeNG's internal
default name and interfere with each other.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zJaaal zJaaal enabled auto-merge April 23, 2026 14:56
zJaaal and others added 3 commits April 23, 2026 12:08
Add tests that assert each p-radioButton and p-checkbox renders with a
name attribute matching its field variable, and that two fields of the
same type do not share a name group (isolation). Covers multi-option
checkboxes, binary checkboxes, and radio groups.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Using forEach on expect is a silent false-positive risk — if the
queried array is empty all assertions pass. Switch to it.each so each
option value gets its own named test case with a single targeted
expect, querying by the specific inputId (field.variable-option.value).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sertions

- Replace generic 'input[type="checkbox"]' selector with '#active' in
  binary checkbox test so it fails explicitly if name is missing
- Add form control value assertions to both isolation tests: after
  setting a value on field A, verify field B's control is unchanged —
  this catches actual grouping regressions, not just DOM attribute state
- Remove forbidden non-null assertion (!) in favor of optional chaining

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@zJaaal zJaaal added this pull request to the merge queue Apr 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 23, 2026
@zJaaal zJaaal added this pull request to the merge queue Apr 23, 2026
Merged via the queue into main with commit 8439011 Apr 23, 2026
28 checks passed
@zJaaal zJaaal deleted the fix/uve-radio-checkbox-name-binding branch April 23, 2026 18:47
@zJaaal zJaaal restored the fix/uve-radio-checkbox-name-binding branch April 24, 2026 15:43
riccardoruocco pushed a commit to riccardoruocco/core that referenced this pull request Apr 27, 2026
We lost this changes after a merge queue incident

Main PR dotCMS#35433

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Frontend PR changes Angular/TypeScript frontend code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

fix(uve): radio buttons and checkboxes in quick-edit form are not independent

3 participants