Skip to content

Commit

Permalink
fix(autocomplete-valid): allow type=tel for appropriate cc types (#2575)
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Oct 21, 2020
1 parent 285c442 commit ae21713
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/checks/forms/autocomplete-appropriate-evaluate.js
Expand Up @@ -7,12 +7,11 @@ function autocompleteAppropriateEvaluate(node, options, virtualNode) {
return true;
}

const number = ['text', 'search', 'number'];
const number = ['text', 'search', 'number', 'tel'];
const url = ['text', 'search', 'url'];
const allowedTypesMap = {
bday: ['text', 'search', 'date'],
email: ['text', 'search', 'email'],
'cc-exp': ['text', 'search', 'month'],
'street-address': ['text'], // Issue: https://github.com/dequelabs/axe-core/issues/1161
tel: ['text', 'search', 'tel'],
'tel-country-code': ['text', 'search', 'tel'],
Expand All @@ -22,8 +21,11 @@ function autocompleteAppropriateEvaluate(node, options, virtualNode) {
'tel-local-prefix': ['text', 'search', 'tel'],
'tel-local-suffix': ['text', 'search', 'tel'],
'tel-extension': ['text', 'search', 'tel'],
'cc-number': number,
'cc-exp': ['text', 'search', 'month', 'tel'],
'cc-exp-month': number,
'cc-exp-year': number,
'cc-csc': number,
'transaction-amount': number,
'bday-day': number,
'bday-month': number,
Expand Down
Expand Up @@ -152,3 +152,9 @@
<input autocomplete="street-address" id="fail6" type="file" />
<input autocomplete="bday-month" type="month" id="fail7" />
<input type="NUMBER" autocomplete="email" id="fail8" />

<input autocomplete="cc-number" type="tel" id="pass78" />
<input autocomplete="cc-exp" type="tel" id="pass79" />
<input autocomplete="cc-exp-month" type="tel" id="pass80" />
<input autocomplete="cc-exp-year" type="tel" id="pass81" />
<input autocomplete="cc-csc" type="tel" id="pass82" />
Expand Up @@ -88,6 +88,11 @@
["#pass74"],
["#pass75"],
["#pass76"],
["#pass77"]
["#pass77"],
["#pass78"],
["#pass79"],
["#pass80"],
["#pass81"],
["#pass82"]
]
}

0 comments on commit ae21713

Please sign in to comment.