feat: add template-valid-autocomplete#2761
Draft
johanrd wants to merge 3 commits into
Draft
Conversation
… (control-group check deliberately omitted)
… duplicateHint message - For type="hidden" with on/off token, report hiddenOnOff and return immediately so onOffCombine is never also emitted on the same attr. - Reword duplicateHint message to cover both the shipping+billing and shipping+shipping cases without "mutually exclusive" framing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This is part of a series where Claude has audited
eslint-plugin-emberagainst jsx-a11y, vuejs-accessibility, angular-eslint, lit-a11y and html-validate,ember-template-lint, and the HTML and WCAG specs.See html-validate
valid-autocompletefor the peer rule. Logic adapted from html-validate (MIT), Copyright 2017 David Sveningsson.Adds
template-valid-autocomplete: validates the grammar of theautocompleteattribute on<form>,<input>,<textarea>,<select>. Token identity, order, and contact-with-field compatibility are checked. The field-name-to-control-group compatibility check (e.g.current-passwordontype="text") is deliberately not implemented — see rationale below.Premise
HTML spec §4.10.19.7 — autofill defines a restricted grammar for
autocomplete: an optionalsection-*, an optionalshipping/billing, an optional contact modifier (home/work/mobile/fax/pager), exactly one field name, and an optionalwebauthn. Browsers and password managers silently drop unknown tokens or mis-ordered combinations — authoring mistakes likeautocomplete="first-name"(should begiven-name) are invisible at runtime.Checks implemented
<form autocomplete>accepts onlyonoroff.<input type="hidden">cannot useon/off.<input type="checkbox|radio|file|submit|image|reset|button">cannot useautocompleteat all.home/work/mobile/fax/pager) only pair with field names from the "with contact" list (tel,email,impp, etc.).Deliberately omitted: field-name-to-control-group check
The spec's autofill field name control group table uses descriptive language for the mapping — "the control group for field name X is Y" — without a MUST/MUST NOT.
<input type="text" autocomplete="current-password">is grammar-valid; UAs are likely to handle it inconsistently, but it is not a spec violation. Two peers (jsx-a11y, lit-a11y) happen to delegate to axe-core'sautocomplete-validvirtual rule, which also omits this check.Flags
Allows
Prior art
autocomplete-validautocomplete-validvalid-autocompleteOpt-in: not added to any preset config.