fix(web-components): #4653 read out radio group label when hidden - #4655
Conversation
There was a problem hiding this comment.
Welcome 👋
Welcome to the ic-ui-kit repo, thank you for submitting a pull request!
How to contribute
Please read our CONTRIBUTING.md, which explains our ways of working and guidelines for contributions.
Code of Conduct
We'd appreciate it if you could read and abide by our Code of Conduct, as we wish to foster an inclusive and respectful community.
Targeting your pull request
We use develop rather than main as the base for contributions - please make sure your PR is targeting develop.
Signing the CLA
We require all contributors to sign our Contributor License Agreement (CLA) before we can accept a contribution. If you are contributing on behalf of an organization please follow your organization's policies in signing CLAs.
Associated issue
Please make sure that your pull request has an issue open - this allows us to keep track of changes made and offer support where needed.
GCHQ-Developer-299
left a comment
There was a problem hiding this comment.
Hi @MFA-G, thank you for your contribution, the code change looks good!
However, the commit message does not follow the structure required in our CONTRIBUTING.md. Please edit your commit message appropriately.
85b1246 to
79850c2
Compare
|
Thanks @GCHQ-Developer-299 — amended in 79850c2. The subject was lower case and the footer used
I'll get the CLA signed as well. |
@MFA-G that's closer, but you have to remove the ticket number from the top line of the commit. 'fix #4658' in the commit body is the correct place to put it. If it helps to provide an example of a good commit message: here is one that has the correct structure |
79850c2 to
229698c
Compare
|
Thanks @GCHQ-Developer-299 — removed the ticket number from the subject line in 229698c, following the structure of the example commit you linked. The commit message is now:
|
|
Hi @MFA-G please rebase your branch against develop to get the audit bump we've just merged in. After that your branch should be ready for us to review |
|
Thanks @GCHQ-Developer-299 — branch is now up to date with I brought The only failing check was the |
|
Hi @MFA-G as requested initially, please rebase against develop instead of merging. |
711437b to
e173922
Compare
|
Done — rebased onto |
|
Thank you @MFA-G that's perfect. Unfortunately we just had to fix an audit issue so I need you to rebase against develop once more, then this should be ready to review! |
When `hideLabel` is true the legend is not rendered, so the radiogroup fieldset has no accessible name at all and screen readers announce the group without its label. Apply `label` as an `aria-label` on the fieldset in that case, matching the documented behaviour of the prop and the way ic-text-field and ic-checkbox-group already behave. fix mi6#4653
e173922 to
ed89804
Compare
|
Rebased onto |
Summary of the changes
When
hideLabelistrue,ic-radio-groupdoes not render the<legend>, and nothing else supplies the group's accessible name — so therole="radiogroup"fieldset ends up with no accessible name and screen readers announce the group without its label. The prop's own docs say the opposite:This applies
labelas anaria-labelon the fieldset when, and only when, the label is hidden:The visible-label path is untouched: the
<legend>still names the group, and noaria-labelis added, so nothing overrides it.ic-text-field(aria-label={label}on the input) andic-checkbox-group(aria-labelledbyon a screen-reader-only span) already do the equivalent — this brings the radio group in line.Related issue
Fixes #4653
Testing
Two spec tests added to
ic-radio-group.spec.ts:hide-label: no<legend>is rendered and the fieldset'saria-labelis the label value;<legend>is rendered and the fieldset has noaria-label(so the legend keeps naming the group).The first fails on
developand passes with the change. Existing snapshots are unaffected, since none of them sethide-label.Checklist
General
Testing
Accessibility
Resize/zoom, system modes, content extremes
Not applicable — the change adds a single ARIA attribute and produces no visual or layout difference.