Technique C42:Using min-height
and min-width
to ensure sufficient target spacing
About this Technique
This technique relates to 2.5.8: Target Size (Minimum) (Sufficient).
This technique applies to all technologies that support CSS and pointer input.
Description
The objective of this technique is to ensure that links in navigation or pagination menus will be spaced so that they fall within an area that measures at least 44 × 44 CSS pixels if the target area itself is smaller than that. The aim is to provide an adequate target clearance so the offset to adjacent targets is sufficient to prevent accidental pointer activation of adjacent targets.
Examples
The following examples can be seen as rendered versions in the working examples.
Example 1: Using a display value of inline-block
, min-height
, and min-width
The first example shows a situation where the targets (in this case, the linked numbers in the pagination navigation) are smaller than 44 × 44 CSS pixels. However, the list items that contain them have a minimum height and width of 44 px set, so that sufficient target spacing is assured.
The HTML
<nav aria-label="pagination">
<ol class="pagination-1">
<li><a class="previous">previous</a></li>
<li><a aria-current="page">1</li>
<li><a href="/page-2">2</a></li>
<li><a href="/page-3">3</a></li>
<li><a href="/page-4">4</a></li>
<li><a href="/page-5">5</a></li>
<li><a href="/pages-6-10">next</a></li>
</ol>
</nav>
The CSS
.pagination-1 li {
display: inline-block;
min-height: 44px;
min-width: 44px;
}
Example 2: Using a display
value of flex
and min-height
/ width
The second example uses min-width
and min-height
on the targets (the linked numbers in the pagination menu) and not on the parent container, thereby meeting this target spacing Success Criterion and incidentally also the AAA Success Criterion 2.5.5 Target Size.
The HTML
<nav aria-label="pagination">
<ol class="pagination-2">
<li><a class="previous">previous</a></li>
<li><a aria-current="page">1</li>
<li><a href="/page-2">2</a></li>
<li><a href="/page-3">3</a></li>
<li><a href="/page-4">4</a></li>
<li><a href="/page-5">5</a></li>
<li><a href="/pages-6-10">next</a></li>
</ol>
</nav>
The CSS
.pagination-2 {
display: flex;
flex-wrap: wrap;
}
ol.pagination-2 a {
display: block;
line-height: 44px;
min-height: 44px;
min-width: 44px;
}
Tests
Procedure
For each target that cannot be enlarged by a mechanism, is not inline, and is not covered by the essential exception:
- Check that the target has enough spacing so that the space around it measures at least 44px width and 44px height.
Expected Results
- Check #1 is true