[checkbox] Render content labels as a real label part (#377) - #379
Merged
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #377. Sibling of #376/#378 — the same
part/partstring-shortcut bypass, applied tocheckbox.What
A string
:label(the common case) was returned verbatim by the part system, so the::labelpart never rendered: norc-checkbox-labelelement,:label-style/:label-classsilently ignored, and no labelon-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::labelspan 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-styleride post-props as before — they now land on a real element.Testing
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.:local/rootoverride: the Tag Constraints "For each …" checkboxes show:label-style {:font-size 12px}landing in the DOM, the app's own.rc-checkbox-labelellipsis 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