Skip to content

[checkbox] Render content labels as a real label part (#377) - #379

Merged
MawiraIke merged 2 commits into
masterfrom
fix/checkbox-label-part
Jul 30, 2026
Merged

[checkbox] Render content labels as a real label part (#377)#379
MawiraIke merged 2 commits into
masterfrom
fix/checkbox-label-part

Conversation

@MawiraIke

Copy link
Copy Markdown
Contributor

Closes #377. Sibling of #376/#378 — the same part/part string-shortcut bypass, applied to checkbox.

What

A string :label (the common case) was returned verbatim by the part system, so the ::label part never rendered: no rc-checkbox-label element, :label-style/:label-class silently ignored, and no label on-click — clicking the label stopped toggling the checkbox, contradicting the component's own docs ("Clicking on the label is the same as clicking on the checkbox"). Masked visually because the checkbox theme spaces via the wrapper's :gap, not label styling.

The fix

Same pattern as #378: content labels (part/content? — string/number/hiccup) render inside the themed ::label span with the content as :children; map/fn part values keep their override semantics; the part structure declares the label's real :tag :span. :label-class/:label-style ride post-props as before — they now land on a real element.

Testing

  • New test/re_com/checkbox_test.cljs (mirrors the [radio-button] Render content labels as a real label part (#376) #378 radio tests): RED on master — no label part in the tree for string/hiccup labels; GREEN with the fix. Suite: 72 tests / 266 assertions, 0 failures.
  • Verified in the demo (DOM shows the restored span; label clicks toggle) and downstream in Briefly via a :local/root override: the Tag Constraints "For each …" checkboxes show :label-style {:font-size 12px} landing in the DOM, the app's own .rc-checkbox-label ellipsis rule applying again (dead since 2.29.3), and label-click toggling — with spacing unchanged (wrapper gap), so no downstream workarounds are needed.

With this and #378 on master, the next re-com release carries both label-part fixes for the fleet bump.

🤖 Generated with Claude Code

MawiraIke and others added 2 commits July 30, 2026 21:02
- Mirrors the #376 radio-button tests: a string :label must render a
  real ::label part carrying rc-checkbox-label + :label-class,
  :label-style, the label as its child, and the on-click that makes
  label clicks toggle; hiccup labels wrap, absent labels emit no part
- RED: part/part's string shortcut returns the label verbatim

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- Same mechanism and fix as radio-button's #376: part/part's string
  shortcut returned a string :label verbatim, bypassing the label
  element, :label-class/:label-style and the label's on-click (label
  clicks stopped toggling). Masked visually because the checkbox theme
  spaces via the wrapper's :gap
- Content labels (part/content?) now render inside the themed ::label
  span with the content as :children; map/fn part values keep their
  override semantics; the part structure declares :tag :span

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@MawiraIke
MawiraIke merged commit 3a68b9f into master Jul 30, 2026
1 check passed
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: string labels bypass the label part — :label-style, :label-class and label-click silently dead (same mechanism as #376)

1 participant