Skip to content

Commit cadadcf

Browse files
committed
Add more precise typing for autoComplete HTML attribute
Replaces: microsoft/TypeScript#52169 This will allow to autocomplete… the `autoComplete` attribute in vscode for example. ![autoComplete autocomplete in vscode](https://user-images.githubusercontent.com/58247/211378145-c01c665b-9f4b-4918-83cc-16532f555935.png) The list is quite long and it's not easy remembering the spelling of each one of them (first_name or given-name? password or current-password?), and it would improve the UX of sites if they were more appropriately used (for example, some people may think that the input's `type` and/or `name` attributes may be enough for fields like email or password, but knowing to use `autoComplete="new-password"` or `one-time-code` can be really useful).
1 parent 369d9d3 commit cadadcf

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

baselines/dom.generated.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -10190,7 +10190,7 @@ interface HTMLFormElement extends HTMLElement {
1019010190
*
1019110191
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/HTMLFormElement/autocomplete)
1019210192
*/
10193-
autocomplete: string;
10193+
autocomplete: "off" | "on" | "name" | "honorific-prefix" | "given-name" | "family-name" | "honorific-suffix" | "nickname" | "email" | "username" | "new-password" | "current-password" | "one-time-code" | "organization-title" | "organization" | "street-address" | "address-line1" | "address-line2" | "address-line3" | "address-level4" | "address-level3" | "address-level2" | "address-level1" | "country" | "country-name" | "postal-code" | "cc-name" | "cc-given-name" | "cc-additional-name" | "cc-family-name" | "cc-number" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-csc" | "cc-type" | "transaction-currency" | "transaction-amount" | "language" | "bday" | "bday-day" | "bday-month" | "bday-year" | "sex" | "tel" | "tel-country-code" | "tel-national" | "tel-area-code" | "tel-local" | "tel-extension" | "impp" | "url" | "photo" | (string & {});
1019410194
/**
1019510195
* Retrieves a collection, in source order, of all controls in a given form.
1019610196
*

inputfiles/overridingTypes.jsonc

+21-1
Original file line numberDiff line numberDiff line change
@@ -1257,6 +1257,10 @@
12571257
"HTMLSelectElement": {
12581258
"properties": {
12591259
"property": {
1260+
"autocomplete": {
1261+
"name": "autocomplete",
1262+
"overrideType": "\"off\" | \"on\" | \"name\" | \"honorific-prefix\" | \"given-name\" | \"family-name\" | \"honorific-suffix\" | \"nickname\" | \"email\" | \"username\" | \"new-password\" | \"current-password\" | \"one-time-code\" | \"organization-title\" | \"organization\" | \"street-address\" | \"address-line1\" | \"address-line2\" | \"address-line3\" | \"address-level4\" | \"address-level3\" | \"address-level2\" | \"address-level1\" | \"country\" | \"country-name\" | \"postal-code\" | \"cc-name\" | \"cc-given-name\" | \"cc-additional-name\" | \"cc-family-name\" | \"cc-number\" | \"cc-exp\" | \"cc-exp-month\" | \"cc-exp-year\" | \"cc-csc\" | \"cc-type\" | \"transaction-currency\" | \"transaction-amount\" | \"language\" | \"bday\" | \"bday-day\" | \"bday-month\" | \"bday-year\" | \"sex\" | \"tel\" | \"tel-country-code\" | \"tel-national\" | \"tel-area-code\" | \"tel-local\" | \"tel-extension\" | \"impp\" | \"url\" | \"photo\" | (string & {})"
1263+
},
12601264
"selectedOptions": {
12611265
"name": "selectedOptions",
12621266
"overrideType": "HTMLCollectionOf<HTMLOptionElement>"
@@ -1660,6 +1664,10 @@
16601664
"HTMLInputElement": {
16611665
"properties": {
16621666
"property": {
1667+
"autocomplete": {
1668+
"name": "autocomplete",
1669+
"overrideType": "\"off\" | \"on\" | \"name\" | \"honorific-prefix\" | \"given-name\" | \"family-name\" | \"honorific-suffix\" | \"nickname\" | \"email\" | \"username\" | \"new-password\" | \"current-password\" | \"one-time-code\" | \"organization-title\" | \"organization\" | \"street-address\" | \"address-line1\" | \"address-line2\" | \"address-line3\" | \"address-level4\" | \"address-level3\" | \"address-level2\" | \"address-level1\" | \"country\" | \"country-name\" | \"postal-code\" | \"cc-name\" | \"cc-given-name\" | \"cc-additional-name\" | \"cc-family-name\" | \"cc-number\" | \"cc-exp\" | \"cc-exp-month\" | \"cc-exp-year\" | \"cc-csc\" | \"cc-type\" | \"transaction-currency\" | \"transaction-amount\" | \"language\" | \"bday\" | \"bday-day\" | \"bday-month\" | \"bday-year\" | \"sex\" | \"tel\" | \"tel-country-code\" | \"tel-national\" | \"tel-area-code\" | \"tel-local\" | \"tel-extension\" | \"impp\" | \"url\" | \"photo\" | (string & {})"
1670+
},
16631671
"selectionDirection": {
16641672
"name": "selectionDirection",
16651673
"overrideType": "\"forward\" | \"backward\" | \"none\""
@@ -1782,6 +1790,10 @@
17821790
"HTMLTextAreaElement": {
17831791
"properties": {
17841792
"property": {
1793+
"autocomplete": {
1794+
"name": "autocomplete",
1795+
"overrideType": "\"off\" | \"on\" | \"name\" | \"honorific-prefix\" | \"given-name\" | \"family-name\" | \"honorific-suffix\" | \"nickname\" | \"email\" | \"username\" | \"new-password\" | \"current-password\" | \"one-time-code\" | \"organization-title\" | \"organization\" | \"street-address\" | \"address-line1\" | \"address-line2\" | \"address-line3\" | \"address-level4\" | \"address-level3\" | \"address-level2\" | \"address-level1\" | \"country\" | \"country-name\" | \"postal-code\" | \"cc-name\" | \"cc-given-name\" | \"cc-additional-name\" | \"cc-family-name\" | \"cc-number\" | \"cc-exp\" | \"cc-exp-month\" | \"cc-exp-year\" | \"cc-csc\" | \"cc-type\" | \"transaction-currency\" | \"transaction-amount\" | \"language\" | \"bday\" | \"bday-day\" | \"bday-month\" | \"bday-year\" | \"sex\" | \"tel\" | \"tel-country-code\" | \"tel-national\" | \"tel-area-code\" | \"tel-local\" | \"tel-extension\" | \"impp\" | \"url\" | \"photo\" | (string & {})"
1796+
},
17851797
"labels": {
17861798
"name": "labels",
17871799
"overrideType": "NodeListOf<HTMLLabelElement>"
@@ -2419,7 +2431,15 @@
24192431
"overrideIndexSignatures": [
24202432
"[index: number]: Element",
24212433
"[name: string]: any"
2422-
]
2434+
],
2435+
"properties": {
2436+
"property": {
2437+
"autocomplete": {
2438+
"name": "autocomplete",
2439+
"overrideType": "\"off\" | \"on\" | \"name\" | \"honorific-prefix\" | \"given-name\" | \"family-name\" | \"honorific-suffix\" | \"nickname\" | \"email\" | \"username\" | \"new-password\" | \"current-password\" | \"one-time-code\" | \"organization-title\" | \"organization\" | \"street-address\" | \"address-line1\" | \"address-line2\" | \"address-line3\" | \"address-level4\" | \"address-level3\" | \"address-level2\" | \"address-level1\" | \"country\" | \"country-name\" | \"postal-code\" | \"cc-name\" | \"cc-given-name\" | \"cc-additional-name\" | \"cc-family-name\" | \"cc-number\" | \"cc-exp\" | \"cc-exp-month\" | \"cc-exp-year\" | \"cc-csc\" | \"cc-type\" | \"transaction-currency\" | \"transaction-amount\" | \"language\" | \"bday\" | \"bday-day\" | \"bday-month\" | \"bday-year\" | \"sex\" | \"tel\" | \"tel-country-code\" | \"tel-national\" | \"tel-area-code\" | \"tel-local\" | \"tel-extension\" | \"impp\" | \"url\" | \"photo\" | (string & {})"
2440+
}
2441+
}
2442+
}
24232443
},
24242444
"Blob": {
24252445
"methods": {

0 commit comments

Comments
 (0)