Skip to content

New Release - 1.2.0

Compare
Choose a tag to compare
@Tomdango Tomdango released this 29 May 15:31

πŸŽ‰ New Release - 1.2.0 πŸŽ‰

This release contains a refactor of the logic around the Form components. Each form component is now wrapped inside of it's own <div class="nhsuk-form-group"> element, and that is where the error classes are set when a component has an error. Note that if you have multiple form elements inside of a Fieldset component, then only one error line will be present for that Fieldset, not for each individual component (this can be disabled with the disableErrorLine={true} prop).
This refactor also helps improve the accessibility of each form component by default. If a hint prop is supplied, the input will automatically gain a aria-describedby prop set to the ID of the Hint component. This is also true of the label prop, where an aria-labelledby prop is supplied. Note that if an ID is not supplied to any form component, it will generate it's own unique ID. This has the potential to break snapshot testing, so any form elements tested using snapshots will require IDs to be set.
If you have previously used the disableErrorFromComponents prop on the Form component in order to implement custom behaviour, this will continue to work.
The final small change is pertinent to the Radios and Checkboxes components - each child (Radios.Radio and Checkboxes.Box respectively) will now assign itself an ID according to (in order of preference) the idPrefix prop (if supplied) or the id of the input component (whether supplied or generated). If an ID is assigned directly to a child component, that will override any generated IDs. Previously, the generated IDs could fall back to using the name prop supplied to the Input component. Because name props do not have to be unique, this was taken back out.

If you have any issues with this release, feel free to pop a message in this channel, or raise an issue on the Github repository.

You can install this version by running:

yarn add nhsuk-react-components@1.2.0
# Or
npm i --save nhsuk-react-components@1.2.0