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.

106 lines
3.6 KiB

  1. # Proposing Axe-core Rules
  2. This document outlines the process of proposing a rule. For a technical description on how to build a rule, read [Developing Axe-core Rules](./rule-development.md)
  3. Before you start coding a new rule for axe-core, you _must_ create a Github issue to document the rule you want to create. There are many considerations to writing a good rule. It must have no false positives, which is difficult, because there are always many many edge cases to consider. Additionally, a known problem of accessibility testing, is that not all testers hold the same interpretation of the accessibility guidelines. All rules _must_ be consistent with the interpretation of Deque Systems, the developer behind Axe-core.
  4. In addition to giving the axe-core development team an opportunity to provide feedback on the proposed rule, the Github Issue will serve as documentation of that rule for the future.
  5. ## WCAG interpretation
  6. Please read our [principles for deciding on rules](./accessibility-supported.md).
  7. ## Rules Format
  8. All Github issues that propose a rule must be tagged as _rule_, and must use the following format:
  9. ### Intro
  10. In one sentence, describe what the rule does.
  11. Example: "Ensures ARIA attributes are allowed for an element's role"\
  12. #### Rule help
  13. In one sentence, describe how to resolve the issue.
  14. Example: "Elements must only use allowed ARIA attributes"
  15. #### Tags
  16. Indicate which tags the rule should use.
  17. Example: wcag2a, wcag211, cat.keyboard
  18. ### Selector
  19. If possible using a CSS selector, otherwise describe in one sentence using plain language what elements the rule selects.
  20. Example 1: `input[type=checkbox][name]`
  21. Example 2: Select each node that has an attribute starting with `aria-`.
  22. ### Checks:
  23. Make each check a subheading of `checks`. Give the check name in the heading, and indicate if the check type is `any`, `all` or `none`.
  24. In short sentences, using plain language, describe what conditions will lead to the check returning false, true or undefined. Keep the steps simple and short. You don't have to write out all the logic. Preferably not, just give the high level view of what the check does.
  25. **Example 1:**
  26. `###` aria/allow-attr (any)
  27. 1. Look up the element role
  28. 2. Look up a list of aria attributes allowed for that role
  29. 3. Return false if the element has aria attributes not in the list
  30. 4. Otherwise return true
  31. **Example 2:**
  32. `###` keyboard/focusable-no-name (none)
  33. 1. If the element is not in the focus order, return false
  34. 2. If the element has an accessible name, return false
  35. 3. Otherwise return true
  36. ## Best practices
  37. For rule design, consider the following as best practices:
  38. 1. Rules should only have one `none` check so that the error message is specific
  39. 2. Rules should not combine `any` and `none`, these should be broken out into separate rules
  40. 3. Checks should each only test a single specific case (either a passing technique or a single failing test)
  41. ## Template
  42. Use this template when creating the issue:
  43. ```markdown
  44. # {{ Rule name }}
  45. {{ Rule description }}
  46. {{ Rule help }}
  47. **Tags:** {{ tag, tag, tag }}
  48. ## Selector
  49. {{ selector }}
  50. ## Checks
  51. ### {{ Check name 1 }} ( any / all / none )
  52. 1.
  53. ### {{ Check name 2, optional }} ( any / all / none )
  54. 1.
  55. ```
  56. ## W3C Standardized Rules
  57. Deque Systems is one of leading organizations in the development of standardized accessibility conformance testing rules. The above format is an adaptation of the [Accessibility Conformance Testing Rules Format](https://www.w3.org/TR/act-rules-format/).
  58. For details on how the above format maps to the ACT Rules format, see [act-rules-format.md](./act-rules-format.md).