Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure check box and radio button labels have the correct for attribute when using a custom id #530

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

spohlenz
Copy link
Member

@spohlenz spohlenz commented Dec 4, 2024

This PR fixes the label's for attribute when using a custom id so that the label remains clickable.

check_box :check_box, id: "custom-id"

Previous result:

<div class="form-check">
  <input name="check_box" type="hidden" value="0" autocomplete="off">
  <input label="Check box" class="form-check-input" type="checkbox" value="1" name="check_box" id="custom-id">
  <label class="form-check-label" for="check_box">Check box</label>
</div>

New result:

<div class="form-check">
  <input name="check_box" type="hidden" value="0" autocomplete="off">
  <input label="Check box" class="form-check-input" type="checkbox" value="1" name="check_box" id="custom-id">
  <label class="form-check-label" for="custom-id">Check box</label>
</div>

@spohlenz spohlenz merged commit 43f5285 into main Dec 4, 2024
44 checks passed
@spohlenz spohlenz deleted the fix-custom-checkbox-id branch December 4, 2024 09:25
@coveralls
Copy link

Coverage Status

coverage: 91.443% (+0.02%) from 91.421%
when pulling b01d143 on fix-custom-checkbox-id
into 0e112ec on main.

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.

2 participants