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.

376 lines
18 KiB

  1. # Check Options
  2. ## Table of Contents
  3. - [How Checks Work](#how-checks-work)
  4. - [Options](#options)
  5. - [Global Options](#global-options)
  6. - [aria-allowed-role](#aria-allowed-role)
  7. - [aria-required-children](#aria-required-children)
  8. - [aria-roledescription](#aria-roledescription)
  9. - [color-contrast](#color-contrast)
  10. - [page-has-heading-one](#page-has-heading-one)
  11. - [page-has-main](#page-has-main)
  12. - [page-no-duplicate-banner](#page-no-duplicate-banner)
  13. - [page-no-duplicate-contentinfo](#page-no-duplicate-contentinfo)
  14. - [page-no-duplicate-main](#page-no-duplicate-main)
  15. - [duplicate-img-label](#duplicate-img-label)
  16. - [label-content-name-mismatch](#label-content-name-mismatch)
  17. - [has-lang](#has-lang)
  18. - [valid-lang](#valid-lang)
  19. - [frame-tested](#frame-tested)
  20. - [no-autoplay-audio](#no-autoplay-audio)
  21. - [css-orientation-lock](#css-orientation-lock)
  22. - [meta-viewport-large](#meta-viewport-large)
  23. - [meta-viewport](#meta-viewport)
  24. - [header-present](#header-present)
  25. - [landmark](#landmark)
  26. - [p-as-heading](#p-as-heading)
  27. - [avoid-inline-spacing](#avoid-inline-spacing)
  28. - [scope-value](#scope-value)
  29. - [region](#region)
  30. ## How Checks Work
  31. [Rules in axe-core](../lib/rules) are made up of one or more individual checks that dictate how the rule works. Each check is typically designed to look for a specific requirement and report back its findings to the rule.
  32. For example, the rule [image-alt](../lib/rules/image-alt.json) uses the checks `has-alt`, `aria-label`, `aria-labelledby`, and `non-empty-title` to determine if the image has an accessible name from an `alt`, `aria-label`, `aria-labelledby`, or `title` attribute (respectively).
  33. Many checks allow you to change how they work through `options` properties. These options can be found in the [checks metadata file](../lib/checks).
  34. For example, the check [has-lang](../lib/checks/language/has-lang.json) takes an `attributes` option which dictates which attributes to check for a lang value.
  35. To customize a check's options, you can use [`axe.configure`](./API.md#api-name-axeconfigure) to configure the check and modify the options as desired.
  36. ```js
  37. // configure has-lang check to look at the `hreflang` attribute as well
  38. axe.configure({
  39. checks: [
  40. {
  41. id: 'has-lang',
  42. options: {
  43. attributes: ['lang', 'xml:lang', 'hreflang']
  44. }
  45. }
  46. ]
  47. });
  48. ```
  49. ## Options
  50. ### Global Options
  51. All checks allow these global options:
  52. | Option | Default | Description |
  53. | -------------- | :------ | :-------------------------------------------------------------- |
  54. | `reviewOnFail` | `false` | Have the check return as "Needs Review" rather than a violation |
  55. ### aria-allowed-role
  56. | Option | Default | Description |
  57. | --------------- | :------ | :---------------------------------------------------------------- |
  58. | `allowImplicit` | `true` | Allow the explicit role to match the implicit role of the element |
  59. | `ignoredTags` | `[]` | Do not check for allowed roles in the provided HTML elements list |
  60. ### aria-required-children
  61. <table>
  62. <thead>
  63. <tr>
  64. <th>Option</th>
  65. <th align="left">Default</th>
  66. <th align="left">Description</th>
  67. </tr>
  68. </thead>
  69. <tbody>
  70. <tr>
  71. <td>
  72. <code>reviewEmpty</code>
  73. </td>
  74. <td align="left">
  75. <pre lang=js><code>[
  76. 'doc-bibliography',
  77. 'doc-endnotes',
  78. 'grid',
  79. 'list',
  80. 'listbox',
  81. 'table',
  82. 'tablist',
  83. 'tree',
  84. 'treegrid',
  85. 'rowgroup'
  86. ]</code></pre>
  87. </td>
  88. <td align="left">List of ARIA roles that should be flagged as "Needs Review" rather than a violation if the element has no owned children</td>
  89. </tr>
  90. </tbody>
  91. </table>
  92. ### aria-roledescription
  93. <table>
  94. <thead>
  95. <tr>
  96. <th>Option</th>
  97. <th align="left">Default</th>
  98. <th align="left">Description</th>
  99. </tr>
  100. </thead>
  101. <tbody>
  102. <tr>
  103. <td>
  104. <code>supportedRoles</code>
  105. </td>
  106. <td align="left">
  107. <pre lang=js><code>[
  108. 'button',
  109. 'img',
  110. 'checkbox',
  111. 'radio',
  112. 'combobox',
  113. 'menuitemcheckbox',
  114. 'menuitemradio'
  115. ]</code></pre>
  116. </td>
  117. <td align="left">List of ARIA roles that support the <code>aria-roledescription</code> attribute</td>
  118. </tr>
  119. </tbody>
  120. </table>
  121. ### color-contrast
  122. | Option | Default | Description |
  123. | ----------------------------------------------------------- | :------ | :---------------------------------------------------------------------------------------------------------- |
  124. | `ignoreUnicode` | `true` | Do not check the color contrast of Unicode characters |
  125. | `ignoreLength` | `false` | Do not check the color contrast of short text content |
  126. | `boldValue` | `700` | The minimum CSS `font-weight` value that designates bold text |
  127. | `boldTextPt` | `14` | The minimum CSS `font-size` pt value that designates bold text as being large |
  128. | `largeTextPt` | `18` | The minimum CSS `font-size` pt value that designates text as being large |
  129. | `shadowOutlineEmMax` | `0.1` | The maximum `blur-radius` value (in ems) of the CSS `text-shadow` property. `blur-radius` values greater than this value will be treated as a background color rather than an outline color. |
  130. | `contrastRatio` | N/A | Contrast ratio options |
  131. | &nbsp;&nbsp;`contrastRatio.normal` | N/A | Contrast ratio requirements for normal text (non-bold text or text smaller than `largeTextPt`) |
  132. | &nbsp;&nbsp;&nbsp;&nbsp;`contrastRatio.normal.expected` | `4.5` | The expected contrast ratio for normal text |
  133. | &nbsp;&nbsp;&nbsp;&nbsp;`contrastRatio.normal.minThreshold` | N/A | The minimum contrast ratio the check will apply to. Contrast ratios less than this value will be ignored |
  134. | &nbsp;&nbsp;&nbsp;&nbsp;`contrastRatio.normal.maxThreshold` | N/A | The maximum contrast ratio the check will apply to. Contrast ratios greater than this value will be ignored |
  135. | &nbsp;&nbsp;`contrastRatio.large` | N/A | Contrast ratio requirements for large text (bold text or text larger than `largeTextPt`) |
  136. | &nbsp;&nbsp;&nbsp;&nbsp;`contrastRatio.large.expected` | `4.5` | The expected contrast contrast ratio for large text |
  137. | &nbsp;&nbsp;&nbsp;&nbsp;`contrastRatio.large.minThreshold` | N/A | The minimum contrast ratio the check will apply to. Contrast ratios less than this value will be ignored |
  138. | &nbsp;&nbsp;&nbsp;&nbsp;`contrastRatio.large.maxThreshold` | N/A | The maximum contrast ratio the check will apply to. Contrast ratios greater than this value will be ignored |
  139. ### page-has-heading-one
  140. <table>
  141. <thead>
  142. <tr>
  143. <th>Option</th>
  144. <th align="left">Default</th>
  145. <th align="left">Description</th>
  146. </tr>
  147. </thead>
  148. <tbody>
  149. <tr>
  150. <td>
  151. <code>selector</code>
  152. </td>
  153. <td align="left">
  154. <pre lang=css><code>h1:not([role]):not([aria-level]),
  155. h1:not([role])[aria-level=1],
  156. h2:not([role])[aria-level=1],
  157. h3:not([role])[aria-level=1],
  158. h4:not([role])[aria-level=1],
  159. h5:not([role])[aria-level=1],
  160. h6:not([role])[aria-level=1],
  161. [role=heading][aria-level=1]</code></pre>
  162. </td>
  163. <td align="left">Selector used to determine if a page has a level one heading</td>
  164. </tr>
  165. </tbody>
  166. </table>
  167. ### page-has-main
  168. | Option | Default | Description |
  169. | ---------- | :-------------------------------------------------- | :--------------------------------------------------------- |
  170. | `selector` | <pre lang=css>main:not([role]), [role='main']</pre> | Selector used to determine if a page has a `main` landmark |
  171. ### page-no-duplicate-banner
  172. | Option | Default | Description |
  173. | ------------------- | :----------------------------------------------------- | :-------------------------------------------------------------------------------------- |
  174. | `selector` | <pre lang=css>header:not([role]), [role=banner]</pre> | Selector used to determine if a page has a `banner` landmark |
  175. | `nativeScopeFilter` | <pre lang=css>article, aside, main, nav, section</pre> | Selector used to ignore `banner` landmarks that have a parent that matches the selector |
  176. ### page-no-duplicate-contentinfo
  177. | Option | Default | Description |
  178. | ------------------- | :--------------------------------------------------------- | :---------------------------------------------------------------------------------------------------- |
  179. | `selector` | <pre lang=css>footer:not([role]), [role=contentinfo]</pre> | Selector used to determine if a page has a `contentinfo` landmark |
  180. | `nativeScopeFilter` | <pre lang=css>article, aside, main, nav, section</pre> | Option values used to ignore `contentinfo` landmarks that have a selector matching the parent element |
  181. ### page-no-duplicate-main
  182. | Option | Default | Description |
  183. | ---------- | :-------------------------------------------------- | :--------------------------------------------------------- |
  184. | `selector` | <pre lang=css>main:not([role]), [role='main']</pre> | Selector used to determine if a page has a `main` landmark |
  185. ### duplicate-img-label
  186. <table>
  187. <thead>
  188. <tr>
  189. <th>Option</th>
  190. <th align="left">Default</th>
  191. <th align="left">Description</th>
  192. </tr>
  193. </thead>
  194. <tbody>
  195. <tr>
  196. <td>
  197. <code>parentSelector</code>
  198. </td>
  199. <td align="left">
  200. <pre lang=css><code>button,
  201. [role=button],
  202. a[href],
  203. p,
  204. li,
  205. td,
  206. th</code></pre>
  207. </td>
  208. <td align="left">Selector used to look at an image parent that may duplicate the image label</td>
  209. </tr>
  210. </tbody>
  211. </table>
  212. ### label-content-name-mismatch
  213. | Option | Default | Description |
  214. | -------------------- | :------ | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
  215. | `pixelThreshold` | `0.1` | Percent of difference in pixel data or pixel width required to determine if a font is a ligature font. Ligature fonts are ignored when comparing the label to the content |
  216. | `occuranceThreshold` | `3` | Number of times the font is encountered before auto-assigning the font as a ligature or not |
  217. ### has-lang
  218. | Option | Default | Description |
  219. | ------------ | :-------------------------------------- | :---------------------------------- |
  220. | `attributes` | <pre lang=js>['lang', 'xml:lang']</pre> | Attributes to check for lang values |
  221. ### valid-lang
  222. | Option | Default | Description |
  223. | ------------ | :----------------------------------------------------------- | :---------------------------------------- |
  224. | `attributes` | <pre lang=js>['lang', 'xml:lang']</pre> | Attributes to check for valid lang values |
  225. | `value` | [Array of all valid langs](../lib/core/utils/valid-langs.js) | List of valid lang values |
  226. ### frame-tested
  227. | Option | Default | Description |
  228. | ------------- | :------ | :---------------------------------------------------------------------------------------- |
  229. | `isViolation` | `false` | If an `iframe` that has not been injected with axe-core should be reported as a violation |
  230. ### no-autoplay-audio
  231. | Option | Default | Description |
  232. | ----------------- | :------ | :---------------------------------------------------------------------------------- |
  233. | `allowedDuration` | `3` | Maximum time in seconds an audio clip may autoplay before being marked as violation |
  234. ### css-orientation-lock
  235. | Option | Default | Description |
  236. | ----------------- | :------ | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
  237. | `degreeThreshold` | `3` | The difference of degrees from 180 and 90 that are considered locked to a specific display orientation (for example, 93° rotated is not considered locked while 94° is) |
  238. ### meta-viewport-large
  239. | Option | Default | Description |
  240. | -------------- | :------ | :---------------------------------------------------------------------------------------------- |
  241. | `scaleMinimum` | `5` | The `scale-maximum` CSS value of the check applies to. Values above this number will be ignored |
  242. | `lowerBound` | `2` | The `scale-minimum` CSS value the check applies to. Values below this number will be ignored |
  243. ### meta-viewport
  244. | Option | Default | Description |
  245. | -------------- | :------ | :------------------------------------------------------------------------------------------- |
  246. | `scaleMinimum` | `2` | The `scale-maximum` CSS value the check applies to. Values above this number will be ignored |
  247. ### header-present
  248. <table>
  249. <thead>
  250. <tr>
  251. <th>Option</th>
  252. <th align="left">Default</th>
  253. <th align="left">Description</th>
  254. </tr>
  255. </thead>
  256. <tbody>
  257. <tr>
  258. <td>
  259. <code>selector</code>
  260. </td>
  261. <td align="left">
  262. <pre lang=css><code>h1:not([role]),
  263. h2:not([role]),
  264. h3:not([role]),
  265. h4:not([role]),
  266. h5:not([role]),
  267. h6:not([role]),
  268. [role=heading]</code></pre>
  269. </td>
  270. <td align="left">Selector used to determine if a page has a heading</td>
  271. </tr>
  272. </tbody>
  273. </table>
  274. ### landmark
  275. | Option | Default | Description |
  276. | ---------- | :------------------------------------ | :--------------------------------------------------------- |
  277. | `selector` | <pre lang=css>main, [role=main]</pre> | Selector used to determine if a page has a landmark region |
  278. ### p-as-heading
  279. <table>
  280. <thead>
  281. <tr>
  282. <th>Option</th>
  283. <th align="left">Default</th>
  284. <th align="left">Description</th>
  285. </tr>
  286. </thead>
  287. <tbody>
  288. <tr>
  289. <td>
  290. <code>margins</code>
  291. </td>
  292. <td align="left">
  293. <pre lang=js><code>[
  294. { "weight": 150, "italic": true },
  295. { "weight": 150, "size": 1.15 },
  296. { "italic": true, "size": 1.15 },
  297. { "size": 1.4 }
  298. ]</code></pre>
  299. </td>
  300. <td align="left">Common CSS values used to display `p` elements as `h1-h6` elements determining if a `p` element is being improperly repurposed</td>
  301. </tr>
  302. </tbody>
  303. </table>
  304. ### avoid-inline-spacing
  305. | Option | Default | Description |
  306. | --------------- | :------------------------------------------------------------------- | :-------------------------------------------- |
  307. | `cssProperties` | <pre lang=js>['line-height', 'letter-spacing', 'word-spacing']</pre> | List of inline spacing CSS properties to flag |
  308. ### scope-value
  309. | Option | Default | Description |
  310. | -------- | :-------------------------------------------------------- | :------------------------- |
  311. | `values` | <pre lang=js>['row', 'col', 'rowgroup', 'colgroup']</pre> | List of valid scope values |
  312. ### region
  313. | Option | Default | Description |
  314. | --------------- | :--------------------------------------------- | :-------------------------------------------------------------------------- |
  315. | `regionMatcher` | <pre lang=css>dialog, [role=dialog], svg</pre> | A matcher object or CSS selector to allow elements to be treated as regions |