Skip to content

fix: radio group labels and id fixes - #20

Merged
jakeaturner merged 1 commit into
mainfrom
fix/radio-group
Jun 22, 2026
Merged

jakeaturner merged 1 commit into
mainfrom
fix/radio-group

Conversation

@jakeaturner

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves RadioGroup accessibility by correctly associating group labels with the radiogroup element and adjusting the React implementation to avoid invalid label for/htmlFor behavior.

Changes:

  • Vue: adds a stable label id and wires it to the radiogroup via aria-labelledby.
  • React: removes Headless UI Field usage and uses a passive Label within RadioGroup to ensure proper radiogroup labeling without emitting for/htmlFor.
  • React tests: adds assertions for unique radio IDs and correct label association.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/vue/src/components/RadioGroup.vue Adds label id and aria-labelledby on the radiogroup for proper accessible naming.
packages/react/src/components/radio-group.tsx Refactors label rendering to avoid invalid for binding and improve radiogroup label association.
packages/react/src/components/tests/a11y.test.tsx Adds a11y-focused regression tests for radiogroup labeling and unique radio IDs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +166 to +169
const labelId = group.getAttribute("aria-labelledby");
expect(labelId).toBeTruthy();

const labelEl = container.querySelector(`#${labelId}`)!;
@jakeaturner
jakeaturner merged commit e2b9eac into main Jun 22, 2026
5 of 6 checks passed
@jakeaturner
jakeaturner deleted the fix/radio-group branch June 22, 2026 21:19
libretexts-bot added a commit that referenced this pull request Jun 22, 2026
## [1.10.2](v1.10.1...v1.10.2) (2026-06-22)

### Bug Fixes

* radio group labels and id fixes ([#20](#20)) ([e2b9eac](e2b9eac))
@libretexts-bot

Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.10.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants