web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.3 KiB

  1. # autocomplete-valid
  2. Ensure the autocomplete attribute is correct and suitable for the form field it is used with.
  3. ## Rule details
  4. This rule takes one optional object argument of type object:
  5. ```
  6. {
  7. "rules": {
  8. "jsx-a11y/autocomplete-valid": [ 2, {
  9. "inputComponents": ["Input", "FormField"]
  10. }],
  11. }
  12. }
  13. ```
  14. ### Succeed
  15. ```jsx
  16. <!-- Good: the autocomplete attribute is used according to the HTML specification -->
  17. <input type="text" autocomplete="name" />
  18. <!-- Good: MyInput is not listed in inputComponents -->
  19. <MyInput autocomplete="incorrect" />
  20. ```
  21. ### Fail
  22. ```jsx
  23. <!-- Bad: the autocomplete attribute has an invalid value -->
  24. <input type="text" autocomplete="incorrect" />
  25. <!-- Bad: the autocomplete attribute is on an inappropriate input element -->
  26. <input type="email" autocomplete="url" />
  27. <!-- Bad: MyInput is listed in inputComponents -->
  28. <MyInput autocomplete="incorrect" />
  29. ```
  30. ## Accessibility guidelines
  31. - [WCAG 1.3.5](https://www.w3.org/WAI/WCAG21/Understanding/identify-input-purpose)
  32. ### Resources
  33. - [axe-core, autocomplete-valid](https://dequeuniversity.com/rules/axe/3.2/autocomplete-valid)
  34. - [HTML 5.2, Autocomplete requirements](https://www.w3.org/TR/html52/sec-forms.html#autofilling-form-controls-the-autocomplete-attribute)