-
Notifications
You must be signed in to change notification settings - Fork 22
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
Improve error summary links #9
Labels
Comments
peteryates
added a commit
that referenced
this issue
Jul 20, 2019
Having no control of the ids is problematic when making the error summary list link _directly_ to the element because, in the case of multi-input fields (like radios and checkboxes) we don't know what's available or what's first This is the first step towards making all error summary links behave as specified in the GOV.UK Design System https://design-system.service.gov.uk/components/error-summary/#linking-from-the-error-summary-to-each-answer Refs #9
peteryates
added a commit
that referenced
this issue
Jul 20, 2019
peteryates
added a commit
that referenced
this issue
Jul 20, 2019
peteryates
added a commit
that referenced
this issue
Jul 20, 2019
peteryates
added a commit
that referenced
this issue
Jul 20, 2019
This was referenced Jul 20, 2019
peteryates
added a commit
that referenced
this issue
Jul 20, 2019
The GOV.UK Design System suggests that the anchor links in error summaries should link to actual form inputs[0], they previously linked to the error message that is associated with the field. This work adds the linking functionality to this form builder. * Errors on fields that have a single element are directly linked. These include: text inputs, telephone inputs, email inputs, url inputs, number inputs, file inputs and select boxes * Errors on date fields always link to the day. Ruby has no concept of part of a date being invalid, so we link to the first input in the group. * Errors on fields with multiple elements, namely radio buttons and check boxes, link to the first radio or checkbox. For the collection methods this happens automatically. For #govuk_radio_buttons_fieldset an extra parameter is required on the first radio button, link_errors should be set to true. Fixes #9 [0] https://design-system.service.gov.uk/components/error-summary#linking-from-the-error-summary-to-each-answer
peteryates
added a commit
that referenced
this issue
Jan 9, 2020
Having no control of the ids is problematic when making the error summary list link _directly_ to the element because, in the case of multi-input fields (like radios and checkboxes) we don't know what's available or what's first This is the first step towards making all error summary links behave as specified in the GOV.UK Design System https://design-system.service.gov.uk/components/error-summary/#linking-from-the-error-summary-to-each-answer Refs #9
peteryates
added a commit
that referenced
this issue
Jan 9, 2020
peteryates
added a commit
that referenced
this issue
Jan 9, 2020
peteryates
added a commit
that referenced
this issue
Jan 9, 2020
peteryates
added a commit
that referenced
this issue
Jan 9, 2020
peteryates
added a commit
that referenced
this issue
Jan 9, 2020
The GOV.UK Design System suggests that the anchor links in error summaries should link to actual form inputs[0], they previously linked to the error message that is associated with the field. This work adds the linking functionality to this form builder. * Errors on fields that have a single element are directly linked. These include: text inputs, telephone inputs, email inputs, url inputs, number inputs, file inputs and select boxes * Errors on date fields always link to the day. Ruby has no concept of part of a date being invalid, so we link to the first input in the group. * Errors on fields with multiple elements, namely radio buttons and check boxes, link to the first radio or checkbox. For the collection methods this happens automatically. For #govuk_radio_buttons_fieldset an extra parameter is required on the first radio button, link_errors should be set to true. Fixes #9 [0] https://design-system.service.gov.uk/components/error-summary#linking-from-the-error-summary-to-each-answer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
The error summary links currently target the error message in the relevant form group. This will take the user to the right part of the page but doesn't totally comply with the GOV.UK Design System guidance and should be improved.
The suggested approach is to simply move the
error_id
from the error message itself:And place it on the relevant element. This will vary per helper:
input
elementtextarea
select
elementinput[type='checkbox']
in that groupinput[type='radio']
in that groupinput[type='file']
I'm not sure if it's possible to set the ID for individual items using Rails' built-in helpers, radios and checkboxes might make this fiddly 😞
The text was updated successfully, but these errors were encountered: