|
| 1 | +--- |
| 2 | +id: vcup8d |
| 3 | +name: Interactive component has size controlled by User Agent |
| 4 | +rule_type: atomic |
| 5 | +description: | |
| 6 | + This rule checks that elements that can receive pointer events have a size controlled by the user agent. |
| 7 | +accessibility_requirements: |
| 8 | + wcag21:2.5.5: # Target size (enhanced) (AAA) |
| 9 | + secondary: 'This success criterion is **less strict** than this rule. This is because the rule does not consider the size of the elements. Some of the failed examples may satisfy this success criterion.' |
| 10 | + wcag22:2.5.8: # Target Size (Minimum) (AA) |
| 11 | + secondary: 'This success criterion is **less strict** than this rule. This is because this criterion has a lower size requirement. Some of the failed examples may satisfy this success criterion.' |
| 12 | +input_aspects: |
| 13 | + - DOM Tree |
| 14 | + - CSS Styling |
| 15 | +acknowledgments: |
| 16 | + authors: |
| 17 | + - Jean-Yves Moyen |
| 18 | +--- |
| 19 | + |
| 20 | +## Applicability |
| 21 | + |
| 22 | +This rule applies to any [HTML element][namespaced element] which [can be targeted by a pointer event][]. |
| 23 | + |
| 24 | +## Expectation |
| 25 | + |
| 26 | +Each test target is a [User Agent controlled component][]. |
| 27 | + |
| 28 | +## Assumptions |
| 29 | + |
| 30 | +- This rule assumes that [focusable][] `widget` are effectively clickable. If a widget is [focusable][] without being clickable, it may fail this rule while [Success Criterion 2.5.5 Target Size (enhanced)][sc255] and [Success Criterion 2.5.8 Target Size (minimum)][sc258] are satisfied. |
| 31 | + |
| 32 | +## Accessibility Support |
| 33 | + |
| 34 | +Hit testing isn't properly defined, and this has been an [issue in the CSS specification](https://github.com/w3c/csswg-drafts/issues/2325) for years. Therefore, different User Agents may perform it differently, resulting in different [clickable areas][clickable area] for the same element. As of February 2024, the ACT rules Community Group is not aware of actual cases resulting in significantly different [clickable areas][clickable area]. |
| 35 | + |
| 36 | +## Background |
| 37 | + |
| 38 | +### Bibliography |
| 39 | + |
| 40 | +- [Understanding Success Criterion 2.5.5: Target Size (enhanced)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-enhanced.html) |
| 41 | +- [Understanding Success Criterion 2.5.8: Target Size (Minimum)](https://www.w3.org/WAI/WCAG22/Understanding/target-size-minimum.html) |
| 42 | + |
| 43 | +## Test Cases |
| 44 | + |
| 45 | +### Passed |
| 46 | + |
| 47 | +#### Passed Example 1 |
| 48 | + |
| 49 | +This checkbox is an [User Agent controlled component][]. |
| 50 | + |
| 51 | +```html |
| 52 | +<p id="accept"> |
| 53 | + <input aria-labelledby="accept" type="checkbox" /> |
| 54 | + I agree with the terms and conditions. |
| 55 | +</p> |
| 56 | +``` |
| 57 | + |
| 58 | +### Failed |
| 59 | + |
| 60 | +#### Failed Example 1 |
| 61 | + |
| 62 | +These radio buttons have their size modified by the author and are therefore not [User Agent controlled components][user agent controlled component]. Their [clickable area][] is too small. |
| 63 | + |
| 64 | +```html |
| 65 | +<style> |
| 66 | + input[type='radio'] { |
| 67 | + width: 1em; |
| 68 | + height: 1em; |
| 69 | + } |
| 70 | +</style> |
| 71 | +<fieldset> |
| 72 | + <legend>Pick a color (required)</legend> |
| 73 | + <label><input type="radio" name="color" value="blue" />Blue</label> |
| 74 | + <label><input type="radio" name="color" value="yellow" />Yellow</label> |
| 75 | +</fieldset> |
| 76 | +``` |
| 77 | + |
| 78 | +#### Failed Example 2 |
| 79 | + |
| 80 | +This `button` is not a [User Agent controlled component][]. |
| 81 | + |
| 82 | +```html |
| 83 | +<style> |
| 84 | + #target { |
| 85 | + width: 35px; |
| 86 | + height: 35px; |
| 87 | + border-radius: 0; |
| 88 | + } |
| 89 | +</style> |
| 90 | +<button id="target" onclick="alert('hello')">Hi</button> |
| 91 | +``` |
| 92 | + |
| 93 | +### Inapplicable |
| 94 | + |
| 95 | +#### Inapplicable Example 1 |
| 96 | + |
| 97 | +These `input` elements and `button` are `disabled` and therefore not [focusable][]. |
| 98 | + |
| 99 | +```html |
| 100 | +<fieldset disabled> |
| 101 | + <label>First name <input /></label><br /> |
| 102 | + <label>Last name <input /></label><br /> |
| 103 | + <button>submit</button> |
| 104 | +</fieldset> |
| 105 | +``` |
| 106 | + |
| 107 | +#### Inapplicable Example 2 |
| 108 | + |
| 109 | +This button cannot be [targeted by a pointer event][] because it is entirely covered by the `div` element with a dashed red border. |
| 110 | + |
| 111 | +```html |
| 112 | +<head> |
| 113 | + <title>Inapplicable Example</title> |
| 114 | + <link rel="stylesheet" href="/test-assets/target-size/shared-styles.css" /> |
| 115 | + <style> |
| 116 | + .cover { |
| 117 | + top: 0; |
| 118 | + height: 50px; |
| 119 | + width: 500px; |
| 120 | + } |
| 121 | + </style> |
| 122 | +</head> |
| 123 | +<body> |
| 124 | + <button onclick="alert('hello')">Say Hello</button> |
| 125 | + |
| 126 | + <div class="cover bad highlight"></div> |
| 127 | +</body> |
| 128 | +``` |
| 129 | + |
| 130 | +[can be targeted by a pointer event]: #can-be-targeted-by-pointer-event 'Definition of Can be Targeted by a Pointer Event' |
| 131 | +[focusable]: #focusable 'Definition of Focusable' |
| 132 | +[namespaced element]: #namespaced-element 'Definition of Namespaced Element' |
| 133 | +[sc255]: https://www.w3.org/TR/WCAG22/#target-size-enhanced 'Success Criterion 2.5.5 Target Size (enhanced)' |
| 134 | +[sc258]: https://www.w3.org/TR/WCAG22/#target-size-minimum 'Success Criterion 2.5.8 Target Size (minimum)' |
| 135 | +[targeted by a pointer event]: #can-be-targeted-by-pointer-event 'Definition of Can be Targeted by a Pointer Event' |
| 136 | +[user agent controlled component]: #user-agent-controlled-component 'Definition of UI Controlled Component' |
0 commit comments