Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support error_items for specific input within date-input
As suggested in #3510. This changes the date-input component so it supports errors on individual input elements, e.g. just the year input element. This usage is described in the docs for the date-input component [1]: > If you’re highlighting just one field - either the day, month or year > - only style the field that has an error. The error message must say > which field has an error, like this: However, highlighting just one field like this is not actually currently supported by the date-input component! The new behaviour (where individual fields are highlighted as having an error) is specified by adding values for a `name` key to the `error_items` with the values matching the values of the `name` key in the `items`. If none of the `error_items` have a value for the `name` key, then we fallback to the original behaviour, i.e. all fields are highlighted as having an error. This should hopefully make this a fairly backwardly-compatible change. [1]: https://design-system.service.gov.uk/components/date-input/#error-messages
- Loading branch information