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

Allow consumers to disable fieldset rendering for single inputs #257

Closed
wants to merge 1 commit into from

Conversation

jakeb-nhs
Copy link
Contributor

During an accessibility review for our Child BMI tool, it was raised that we wrap all our inputs in fieldset elements even if there is only a single one. This is incorrect/dubious because fieldsets are semantically used to group related inputs together, and if there is only one there is no need for a fieldset to be used.

From a screen reader point of view. they announce fieldsets as a group. i.e. a group of input fields, so a user might expect there to be more than 1. This could cause confusion and is extra audio clutter.

Guidance on this in the NHS service manual is light, but reading the page on Fieldset suggests it is only to be used when grouping multiple inputs.

Now, when using the Fieldset component, there is a prop that consumers can use to control this behaviour. If setting disableFieldsetRenderWithSingleFormElements to true, the fieldset element within the nhsuk-form-group wrapper will not be rendered if the group contains only a single input. The default for this prop is false, meaning no change to current behaviour.

@jakeb-nhs jakeb-nhs force-pushed the prevent-fieldset-render-for-single-inputs branch from ec1d3cf to ab1d9c4 Compare October 7, 2024 09:34
Copy link

sonarqubecloud bot commented Oct 7, 2024

@jakeb-nhs jakeb-nhs closed this Oct 8, 2024
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