-
Notifications
You must be signed in to change notification settings - Fork 338
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
Focus not logical when error committed using the error summary component #1398
Comments
I have assigned priority high since after an initial discussion with the team. Since when the error summary links are clicked they leave the anchor id for the input in the URL, if you submit the form again you will skip to the previously errored input. In GOV.UK Elements this behaviour was prevented but we did not introduce this in GOV.UK Frontend as we were not sure why this was done. We could either
I would recommend doing 2. since 1. feels easy to miss for our users. |
When error summary links are clicked, this adds a hash to the URL. As reported in #1398, if the form is submitted again with further errors, the hash will stop the error summary being focused as should happen and instead the element with the hash ID is scrolled to which is confusing for the user. This behaviour was prevented in GOV.UK Elements but we were not sure at the time why this was necessary so it wasn't reintroduced in GOV.UK Frontend. As we need to use preventDefault() to stop the page scrolling to the form element itself and to show the error message above to make it clear what happened, we programmatically reintroduced the hash to the URL to replicate browser behaviour. Following the bug report #1398, the code that adds the hash is redundant and can be removed. Co-authored by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
When error summary links are clicked, this adds a hash to the URL. As reported in #1398, if the form is submitted again with further errors, the hash will stop the error summary being focused as should happen and instead the element with the hash ID is scrolled to which is confusing for the user. This behaviour was prevented in GOV.UK Elements but we were not sure at the time why this was necessary so it wasn't reintroduced in GOV.UK Frontend. As we need to use preventDefault() to stop the page scrolling to the form element itself and to show the error message above to make it clear what happened, we programmatically reintroduced the hash to the URL to replicate browser behaviour. Following the bug report #1398, the code that adds the hash is redundant and can be removed. Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
When error summary links are clicked, this adds a hash to the URL. As reported in #1398, if the form is submitted again with further errors, the hash will stop the error summary being focused as should happen and instead the element with the hash ID is scrolled to which is confusing for the user. This behaviour was prevented in GOV.UK Elements but we were not sure at the time why this was necessary so it wasn't reintroduced in GOV.UK Frontend. As we need to use preventDefault() to stop the page scrolling to the form element itself and to show the error message above to make it clear what happened, we programmatically reintroduced the hash to the URL to replicate browser behaviour. Following the bug report #1398, the code that adds the hash is redundant and can be removed. Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
When error summary links are clicked, this adds a hash to the URL. As reported in #1398, if the form is submitted again with further errors, the hash will stop the error summary being focused as should happen and instead the element with the hash ID is scrolled to which is confusing for the user. This behaviour was prevented in GOV.UK Elements but we were not sure at the time why this was necessary so it wasn't reintroduced in GOV.UK Frontend. As we need to use preventDefault() to stop the page scrolling to the form element itself and to show the error message above to make it clear what happened, we programmatically reintroduced the hash to the URL to replicate browser behaviour. Following the bug report #1398, the code that adds the hash is redundant and can be removed. Co-authored-by: Oliver Byford <oliver.byford@digital.cabinet-office.gov.uk>
Confirmed as fixed in a re-test by DAC on 7th October 2019 |
This issue is from a May 2019 external accessibility audit report.
WCAG Reference: 2.4.3 Focus Order (Level A)
Issue ID: DAC_Issue14
URL: http://govuk-frontend-v3.herokuapp.com/full-page-examples/passport-details#expiry-month
Page: Passport details
Summary
When an error had occurred, focus was taken to the second date field which was disorientating for some users
Screen Shot
When the form fields were left empty and the form submitted, the users focus was jumped to the second date entry field. This was confusing to users as it was not clear why this field had received focus.
Current Code Ref(s)
Screen reader comments
Keyboard only comments:
Solution
Ensure that when the user commits an error on the page, focus is sent to the error summary heading. Once the error link is selected, focus must be placed on the first field in a group.
The text was updated successfully, but these errors were encountered: