useValidAutocomplete
¥Summary
-
规则生效日期:
v1.9.0¥Rule available since:
v1.9.0 -
诊断类别:
lint/a11y/useValidAutocomplete¥Diagnostic Category:
lint/a11y/useValidAutocomplete -
此规则为推荐规则,默认启用。
¥This rule is recommended, which means is enabled by default.
-
此规则没有修复方案。
¥This rule doesn’t have a fix.
-
此规则的默认严重级别为 error。
¥The default severity of this rule is error.
-
来源:
¥Sources:
-
与
jsx-a11y/autocomplete-valid相同¥Same as
jsx-a11y/autocomplete-valid
-
¥How to configure
{ "linter": { "rules": { "a11y": { "useValidAutocomplete": "error" } } }}¥Description
对 input 元素上的 autocomplete 属性使用有效值。
¥Use valid values for the autocomplete attribute on input elements.
HTML 自动补齐属性仅接受特定的预定义值。与 type 属性相比,这允许更详细的目的定义。使用这些预定义值,用户代理和辅助技术可以以不同的方式向用户呈现输入目的。
¥The HTML autocomplete attribute only accepts specific predefined values.
This allows for more detailed purpose definitions compared to the type attribute.
Using these predefined values, user agents and assistive technologies can present input purposes to users in different ways.
¥Examples
¥Invalid
<input type="text" autocomplete="incorrect" />code-block.jsx:1:20 lint/a11y/useValidAutocomplete ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
✖ Use valid values for the autocomplete attribute.
> 1 │ <input type=“text” autocomplete=“incorrect” />
│ ^^^^^^^^^^^^^^^^^^^^^^^^
2 │
ℹ The autocomplete attribute only accepts a certain number of specific fixed values.
ℹ Follow the links for more information,
WCAG 1.3.5
HTML Living Standard autofill
HTML attribute: autocomplete - HTML: HyperText Markup Language | MDN
¥Valid
<> <input type="text" autocomplete="name" /> <MyInput autocomplete="incorrect" /></>¥Options
{ "linter": { "rules": { "a11y": { "useValidAutocomplete": { "options": { "inputComponents": [ "MyInput" ] } } } } }}可访问性指南
Section titled “可访问性指南”¥Accessibility guidelines
¥Resources
-
HTML 属性:autocomplete - HTML:超文本标记语言 | MDN
¥HTML attribute: autocomplete - HTML: HyperText Markup Language | MDN
¥Related links
Biome v2.1 中文网 - 粤ICP备13048890号