Skip to content
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

Merged
merged 4 commits into from
Jan 17, 2019

Conversation

hannalaakso
Copy link
Member

@hannalaakso hannalaakso commented Jan 16, 2019

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.

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.
@govuk-design-system-ci govuk-design-system-ci temporarily deployed to govuk-frontend-review-pr-1146 January 16, 2019 17:48 Inactive
Copy link
Contributor

@NickColley NickColley left a 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')
Copy link
Contributor

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...

Copy link
Member Author

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.

@hannalaakso hannalaakso force-pushed the enable-autocomplete-on-components branch from 8f8dca0 to 601f592 Compare January 17, 2019 08:56
@hannalaakso hannalaakso merged commit c64847e into master Jan 17, 2019
@hannalaakso hannalaakso deleted the enable-autocomplete-on-components branch January 17, 2019 15:51
@NickColley NickColley added this to the [NEXT] milestone Jan 21, 2019
This was referenced Jan 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants