-
Notifications
You must be signed in to change notification settings - Fork 70
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
Autocomplete attribute has valid value updates #1567
Changes from all commits
1f735b0
091255c
07bbefe
561e9b7
90fcb2f
fc8bb3e
b48ae5d
e09f82f
63ee4aa
a18822e
37e3077
df414d6
149a7ab
38fe055
bb7d4bf
7855e22
ffd3f0a
0c1ad5d
a8fc7fd
d9e82c9
491cac9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,9 +23,10 @@ acknowledgments: | |
|
||
This rule applies to any HTML `input`, `select` and `textarea` element with an `autocomplete` [attribute value][] that is neither empty (`""`) nor only [ASCII whitespace][], except if one of the following is true: | ||
|
||
- **autofill expectation**: the `autocomplete` attribute consists of a single token that is [ASCII case-insensitive][] match for string `off` or string `on`; or | ||
- **hidden**: the element is not [visible][], and not [included in the accessibility tree][]; or | ||
- **disabled**: the element is a [disabled element]; or | ||
- **fixed value**: the element is an `input` element with a `type` [attribute value][] of either `hidden`, `button`, `submit` or `reset`; or | ||
- **fixed value**: the element is an `input` element with a `type` [attribute value][] of `hidden`, `button`, `submit` or `reset`; or | ||
- **static**: the element is not part of [sequential focus navigation][] and has a [semantic role][] that is not a [widget role][]. | ||
|
||
## Expectation 1 | ||
|
@@ -37,19 +38,15 @@ Each test target's `autocomplete` [attribute value][] is a [space separated][] l | |
3. An optional token of either "home", "work", "mobile", "fax" or "pager", only if the last token is "email", "impp", "tel" or "tel-\*"; then | ||
4. A required token from the [correct autocomplete field][]. | ||
|
||
## Expectation 2 | ||
|
||
Each test target's `autocomplete` [attribute value][] has a [correct autocomplete field][] that is [appropriate][appropriate field for the form control] for that test target. | ||
|
||
## Assumptions | ||
|
||
The `autocomplete` attribute is used on form fields that correspond to [Input Purposes for User Interface Components](https://www.w3.org/TR/WCAG21/#input-purposes) and collect information about the user. | ||
|
||
If the `autocomplete` attribute is used to describe "custom" taxonomy, for example `<input type="text" autocomplete="banner" />`, success Criterion [1.3.5 Identify Input Purpose][sc135] may be satisfied even if this rule failed. | ||
|
||
The `type` attribute is used correctly according to the intended purpose of `input` elements. If an incorrect `type` attribute is used for `input` elements, this rule may fail elements that satisfy success Criterion [1.3.5 Identify Input Purpose][sc135]. For example if an `input` element has a `type` of `number`, but is expecting an e-mail address. | ||
The `aria-disabled` state is used on `input` elements which are not part of [sequential focus navigation][] and are not otherwise [operable](https://www.w3.org/TR/wai-aria-1.2/#dfn-operable). If this is not the case, this rule may be inapplicable on elements that are still operable and require a valid `autocomplete` attribute to satisfy success Criterion [1.3.5 Identify Input Purpose][sc135]. | ||
|
||
The `aria-disabled` state is used on `input` elements which are not part of [sequential focus navigation][] and are not otherwise [operable](https://www.w3.org/TR/wai-aria-1.2/#dfn-operable). If this is not the case, this rule may be inapplicable on elements that are still [operable](https://www.w3.org/TR/wai-aria-1.2/#dfn-operable) and require a valid `autocomplete` attribute to satisfy success Criterion [1.3.5 Identify Input Purpose][sc135]. | ||
Mainstream user agents tend to provide autofill suggestions for `input` elements with or without an [appropriate field name for the form control][]. As such, the assistive technologies should be able recognize the purpose of a control even when the `autocomplete` [attribute value][] is inappropriate for the control's `type` [attribute value][]. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure what is the assumption here… That should either be moved to the background or phrased in a way that mak the assumption obvious (even though I agree that the "This rule assumes that…" formulation is a bit heavy, I like it before it make it easy to spot the actual assumption and easier to write something which is actually an assumption). |
||
|
||
## Accessibility Support | ||
|
||
|
@@ -74,15 +71,15 @@ The auto-completing feature of the `autocomplete` attribute benefits many users, | |
|
||
#### Passed Example 1 | ||
|
||
This `autocomplete` [attribute value][] only has the required token, and is valid for an `input` element which has a default type of `text`. | ||
This `autocomplete` [attribute value][] only has the required token "username". | ||
|
||
```html | ||
<label>Username<input autocomplete="username"/></label> | ||
``` | ||
|
||
#### Passed Example 2 | ||
|
||
This `autocomplete` [attribute value][] only has the required token, and is valid for a `select` element. Even though the element's [form owner](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-owner) has `autocomplete="off"`, thus preventing the user agent from completing it, it does not prevent the `autocomplete` [attribute value][] from being programmatically identifiable. | ||
The `autocomplete` [attribute value][] only of the `select` element has the required token "bday-month". Even though the element's [form owner](https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#form-owner) has `autocomplete="off"`, thus preventing the user agent from completing it, it does not prevent the `autocomplete` [attribute value][] from being programmatically identifiable. | ||
|
||
```html | ||
<form autocomplete="off"> | ||
|
@@ -98,23 +95,23 @@ This `autocomplete` [attribute value][] only has the required token, and is vali | |
|
||
#### Passed Example 3 | ||
|
||
This `autocomplete` [attribute value][] only has the required token, and is valid for a `textarea` element. Mixing upper and lower case letters is allowed for `autocomplete` attributes. | ||
This `autocomplete` [attribute value][] only has the required token "street-address". Mixing upper and lower case letters is allowed for `autocomplete` attributes. | ||
|
||
```html | ||
<label> Street address<textarea autocomplete="Street-Address"></textarea></label> | ||
``` | ||
|
||
#### Passed Example 4 | ||
|
||
This `autocomplete` [attribute value][] list includes a `work` token, allowed because it is used before `email`. The `email` token is allowed on `input` elements with a `type` [attribute value][] of `text`. | ||
This `autocomplete` [attribute value][] list includes a `work` token, allowed because it is used before `email`. | ||
|
||
```html | ||
<label>Work email<input autocomplete="Work Email"/></label> | ||
``` | ||
|
||
#### Passed Example 5 | ||
|
||
This `autocomplete` [attribute value][] list includes a `section-` token, which can preface any [correct autocomplete field][]. The `email` token is allowed on `input` elements with a `type` [attribute value][] of `text`. | ||
This `autocomplete` [attribute value][] list includes a `section-` token, which can preface any [correct autocomplete field][]. | ||
|
||
```html | ||
<label>Partner's email address<input autocomplete="section-partner email"/></label> | ||
|
@@ -130,12 +127,20 @@ This `autocomplete` [attribute value][] list includes `section-` and `billing` t | |
|
||
#### Passed Example 7 | ||
|
||
This `autocomplete` [attribute value][] list includes all allowed types of tokens in the correct order. The `email` token is allowed on `input` elements with a `type` [attribute value][] of `text`. | ||
This `autocomplete` [attribute value][] list includes all allowed types of tokens in the correct order. | ||
|
||
```html | ||
<label>Office email<input type="text" autocomplete="section-primary shipping work email"/></label> | ||
``` | ||
|
||
#### Passed Example 8 | ||
|
||
This `autocomplete` [attribute value][] only has the required token "bday-day". It remains programmatically identifiable even though it is inappropriate for the control's `type` [attribute value][] "tel". | ||
|
||
```html | ||
<label>Birthday day<input name="bdayday" type="tel" autocomplete="bday-day"/></label> | ||
``` | ||
|
||
### Failed | ||
|
||
#### Failed Example 1 | ||
|
@@ -148,7 +153,7 @@ This `autocomplete` [attribute value][] has an unknown term that is not a [corre | |
|
||
#### Failed Example 2 | ||
|
||
This `autocomplete` [attribute value][] has the `work` token on a [correct autocomplete field][], however `work` can not be used with `photo`. | ||
This `autocomplete` [attribute value][] has the `work` token which is a [correct autocomplete field][]. However, `work` can not be used with `photo`. | ||
|
||
```html | ||
<label>Photo<input autocomplete="work photo"/></label> | ||
|
@@ -190,71 +195,64 @@ The `autocomplete` attribute value is on an `input` element that does not have a | |
|
||
#### Inapplicable Example 1 | ||
|
||
This `button` element does not support `autocomplete` attributes. | ||
|
||
```html | ||
<button autocomplete="username"></button> | ||
``` | ||
|
||
#### Inapplicable Example 2 | ||
|
||
This `autocomplete` [attribute value][] is empty (""). | ||
|
||
```html | ||
<label>Username<input autocomplete=""/></label> | ||
``` | ||
|
||
#### Inapplicable Example 3 | ||
#### Inapplicable Example 2 | ||
|
||
This `autocomplete` [attribute value][] contains only [ASCII whitespace][]. | ||
|
||
```html | ||
<label>Username<input autocomplete=" "/></label> | ||
``` | ||
|
||
#### Inapplicable Example 4 | ||
#### Inapplicable Example 3 | ||
|
||
This `autocomplete` [attribute value][] is on an element that is not [visible][] through `display:none`. | ||
|
||
```html | ||
<label>Username<input autocomplete="username" style="display:none"/></label> | ||
``` | ||
|
||
#### Inapplicable Example 5 | ||
|
||
This `autocomplete` attribute is on an `input` element with a `type` [attribute value][] that does not support autocomplete. | ||
|
||
```html | ||
<label>Username<input type="button" autocomplete="username"/></label> | ||
``` | ||
|
||
#### Inapplicable Example 6 | ||
#### Inapplicable Example 4 | ||
|
||
This `autocomplete` attribute is on an `input` element that has the `disabled` attribute. | ||
|
||
```html | ||
<label>Username<input autocomplete="username" disabled/></label> | ||
``` | ||
|
||
#### Inapplicable Example 7 | ||
#### Inapplicable Example 5 | ||
|
||
This `autocomplete` attribute is on an `input` element that has the `aria-disabled` [attribute value][] of `true`. | ||
|
||
```html | ||
<label>Username<input autocomplete="username" aria-disabled="true"/></label> | ||
``` | ||
|
||
#### Inapplicable Example 8 | ||
#### Inapplicable Example 6 | ||
|
||
This `autocomplete` attribute is ignored because it is on an element with a [semantic role][] of `none`. The `disabled` attribute is required to ensure [presentational roles conflict resolution][] does not cause the `none` role to be ignored. | ||
|
||
```html | ||
<label>Username<input type="text" role="none" disabled autocomplete="username"/></label> | ||
``` | ||
|
||
#### Inapplicable Example 7 | ||
|
||
This `autocomplete` attribute is inapplicable because it has the `off` value. | ||
|
||
```html | ||
<label>Friend's first name<input type="text" autocomplete="off"/></label> | ||
``` | ||
|
||
[ascii whitespace]: https://infra.spec.whatwg.org/#ascii-whitespace 'HTML ASCII whitespace 2020/08/12' | ||
[ascii case-insensitive]: https://infra.spec.whatwg.org/#ascii-case-insensitive 'definition of ASCII case-insensitive' | ||
[attribute value]: #attribute-value 'Definition of Attribute Value' | ||
[appropriate field for the form control]: #appropriate-field-for-the-form-control 'Definition of Appropriate field for the form control' | ||
[appropriate field name for the form control]: #appropriate-field-for-the-form-control 'Definition of Appropriate field for the form control' | ||
[correct autocomplete field]: #correct-autocomplete-field 'Definition of Correct autocomplete field' | ||
[disabled element]: #disabled-element 'Definition of Disabled Element' | ||
[html specification for autofill detail tokens]: https://html.spec.whatwg.org/#autofill-detail-tokens 'HTML Autofill Detail, 2020/08/12' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ A _rendered image resource_ in a [web page][] is any resource with [visible pixe | |
[embedded image]: #embedded-image 'Definition of Embedded Image' | ||
[image sources]: https://html.spec.whatwg.org/multipage/images.html#image-source | ||
[visible pixels]: #visible 'Definition of visible' | ||
[web page]: #web-page-html 'Definition of web page (HTML)' | ||
[web page]: #web-page-html 'Definition of web page (HTML)' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As above. Please undo this. Don't want an autocomplete fix to be in the file history. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, not sure how that's happened. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @WilcoFiers I managed to get rid of the change in embedded-image file but I'm not sure what is happening here. There is literally no change at all. Do you have any suggestions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I managed to reverse the updating with origin commit which has caused an issue but there was too much fiddling around with it so decided it would be clearer/ easier to cancel the pr and start from the beginning. |
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.
You still have some failing examples that now pass the rule. Can you take those out and add in a passed example showing this should no longer be failed?
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.
Will add an example with an incorrect type. Which failed example is now passing? I've looked through them again and I'm not sure which ones you mean.
I've also checked the examples with optional tokens and if they are in the wrong order, querying the
autocomplete
returns an empty string, which is in line with what we currently have.