Introduction
Starting with Web Content Accessibility Guidelines (WCAG) 2.1 level AAA, the target size criterion is becoming more and more of a relevant to the web.
Right now, a minimum version of it is set in the recommendation candidate for WCAG 2.2 level AA.
Validating the AAA level is not necessary for XWiki since it’s not a specialized software, however we aim at validating the AA level. Even if this recommendation is not yet official, I think adding it to our code style now is important.
What is target size?
The size (height, width) of the target for pointer inputs.
Those can be links, buttons, dropdown, …
What are current recommendations?
A lot of recommendations exist (Apple, Microsoft, Google), with different units. However here I’ll only describe the WCAG ones mentionned above.
- Minimum (AA): The target size is at least 24*24 CSS pixels.
- High standard (AAA): The target size is at least 44*44 CSS pixels.
See the Pen Target sizes WCAG.
Why should we follow them?
This can be a huge increase to accessibility AND usability. Using a button that’s too small can be difficult for:
- users with motor issues
- users with pointing devices different than a mouse, for example touchscreens
- optical mouse users (imprecision of the device)
- mouse users with the wrong dpi
Ever tried to click on a small button on a webpage when on the subway or in the back of a car?
Having too small of a target can be troublesome, even if in the end you still manage to click the right target. That’s what Fitt’s law describes. By making sure the target size is high enough, we can keep high throughput for any user action on the interface and effectively make the interface easier to navigate through.
Exceptions in the recommendations
These rules on target size are very simple, but you might have noticed that it’s not convenient or applicable to all cases. WCAG recommendations highlight these exceptions to the rule:
- Inline: The target is inline, then its height is constrained by line-height.
- Spacing: There is enough non targettable space around the target so that we could grow it the required size without overlapping any other target. The target can be smaller then.
- Equivalent: Two targets have the same function, only one of them needs to have the required size.
- User agent control: Target size determined by the user.
- Essential: The target presentation is essential for the info being conveyed (up to interpretation…).
Proposal
Changes to our CSS recommendations:
- The WCAG 2.2 AA success criterion 2.5.8 must be followed, with exceptions.
- The WCAG 2.1 AAA success criterion 2.5.5 should be followed, with exceptions.
I also propose we add a couple skin variables to make following those recommendations easier:
-
@target-size-minimum
= 24px -
@target-size-required
= 44px
Conclusion
What do you think of this proposal?
I’m not sure whether we should just include a link to the WCAG SC (as done above) or explicitely state the sizes and then include the link for more details.
I’m looking forward to your feedback and opinions on these matters!
Resources:
- Podcast explaining the target size SC (~40 mins, 2021) #266 Target size - UX Podcast
- Article by an A11y writer (~15 mins, posted in 2019, updated) Target Size and 2.5.5 — Adrian Roselli
- Understanding Success Criterion 2.5.5: Target Size | WAI | W3C
- Understanding Success Criterion 2.5.8: Target Size (Minimum) | WAI | W3C
- XWiki issue where this question initially arose: XWIKI-19469
- A few ways to implement larger target sizes: Enhancing The Clickable Area Size - Ahmad Shadeed