Skip to content

fix(BBBCheckbox): respect caller-provided id prop & feat(BBBCheckbox): add dataTest prop for the underlying input - #80

Merged
Arthurk12 merged 2 commits into
bigbluebutton:developfrom
Arthurk12:issue/77
Sep 19, 2026
Merged

Arthurk12 merged 2 commits into
bigbluebutton:developfrom
Arthurk12:issue/77

Conversation

@Arthurk12

Copy link
Copy Markdown
Member

What does this PR do?

Fixes an issue with the ID passed to the BBBCheckbox component, which was silently overridden. Also, adds a explicit data test prop to this component, in order to make testing easier.

Closes Issue(s)

Closes #77

BBBCheckbox always rendered with an internally generated id from
useId(), because {...props} was spread before the explicit id
attribute, so the generated value silently overwrote any id passed
by the caller. This made it impossible to target the rendered input
by a known id and broke the label/htmlFor association whenever a
custom id was expected.

Destructure id from props and fall back to useId() only when the
caller does not provide one, reusing the resolved value for both the
checkbox input and the label's htmlFor attribute.
BBBCheckbox has no way to tag its rendered <input> for test
selectors. Spreading an arbitrary data-test through {...props} does
not work: MUI's SwitchBase only forwards explicitly recognized props
(id, checked, name, inputProps) to the actual <input>, so anything
else spread through falls into the outer wrapper <span> instead —
the same class of issue fixed for id in the previous commit.

Add an explicit dataTest prop, matching the convention already used
by BBButton and BBBInput, and route it through MUI's inputProps so
it lands on the real <input>, merging with any inputProps the caller
already passes directly.
@Arthurk12 Arthurk12 changed the title fix(BBBCheckbox): respect caller-provided id prop & feat(BBBCheckbox): add dataTest prop for the underlying input fix(BBBCheckbox): respect caller-provided id prop & feat(BBBCheckbox): add dataTest prop for the underlying input Sep 19, 2026
@Arthurk12
Arthurk12 merged commit 768b281 into bigbluebutton:develop Sep 19, 2026
2 checks passed
@Arthurk12
Arthurk12 deleted the issue/77 branch September 19, 2026 13:09
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