-
Notifications
You must be signed in to change notification settings - Fork 334
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
Enable autocomplete
attributes for input components
#1146
Conversation
WCAG 2.1 introduces a new success criteria "1.3.5 Identify Input Purpose" which "is to ensure that the purpose of a form input collecting information about the user can be programmatically determined, so that user agents can extract and present this purpose to users using different modalities". Broadly speaking, we can help service teams meet this criteria by making it easier to pass autocomplete attributes to components. At the minute this can be done by using the attributes option, but making it part of the component API promotes the idea that this should be used when it makes sense to do so.
WCAG 2.1 introduces a new success criteria "1.3.5 Identify Input Purpose" which "is to ensure that the purpose of a form input collecting information about the user can be programmatically determined, so that user agents can extract and present this purpose to users using different modalities". Broadly speaking, we can help service teams meet this criteria by making it easier to pass autocomplete attributes to components. At the minute this can be done by using the attributes option, but making it part of the component API promotes the idea that this should be used when it makes sense to do so.
WCAG 2.1 introduces a new success criteria "1.3.5 Identify Input Purpose" which "is to ensure that the purpose of a form input collecting information about the user can be programmatically determined, so that user agents can extract and present this purpose to users using different modalities". Broadly speaking, we can help service teams meet this criteria by making it easier to pass autocomplete attributes to components. At the minute this can be done by using the attributes option, but making it part of the component API promotes the idea that this should be used when it makes sense to do so.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks really good to me! 🚀
I don't think we necessarily need the review application examples since we can test this fine with the unit tests but It's no harm for them to be there (potentially we'll want to test autofill behaviour in the future?)
I think you need a changelog entry.
}) | ||
|
||
const $firstItems = $('.govuk-date-input__item:first-child input') | ||
expect($firstItems.attr('autocomplete')).toEqual('bday-day') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Non-blocking: I wonder if we should assert that all three are there...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Nick 👍 Going to leave it as it is for now to keep things consistent, there's about 10 tests in this file that follow the same pattern. Maybe it's something we can look at separately.
8f8dca0
to
601f592
Compare
Set textarea, input and date input components to accept
autocomplete
option and add tests to ensure the attribute gets rendered.This helps to surface the new WCAG 2.1 guidelines for "Identify Input Purpose" - see #1136
There's also a card to document this in the Design System.
Fixes #1136
Edit: The initial PR also updated the character count to do this. This change was subsequently removed as it appears that of the autofill attributes, only
street-address
can be multiline and character count wouldn't be used in this scenario.