|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en"> |
| 3 | + <head> |
| 4 | + <meta charset="utf-8"> |
| 5 | + <title>Using CSS to ensure targets are at least 44 by 44 CSS pixels</title> |
| 6 | + </head> |
| 7 | + <body> |
| 8 | + <h1>Using CSS to ensure targets are at least 44 by 44 CSS pixels</h1> |
| 9 | + <section id="applicability"> |
| 10 | + <h2>When to Use</h2> |
| 11 | + <p>All technologies that support CSS and pointer input.</p> |
| 12 | + </section> |
| 13 | + <section id="description"> |
| 14 | + <h2>Description</h2> |
| 15 | + <p>The objective of this technique is to ensure that links in pagination components have enough spacing around them to meet the requirements of <a href="../../understanding/21/target-size-enhanced.html">Success Criterion 2.5.5, Target Size (Enhanced)</a>. The aim is to provide an adequate target clearance to prevent accidental pointer activation of adjacent targets.</p> |
| 16 | + </section> |
| 17 | + |
| 18 | + <section id="examples"> |
| 19 | + <h2>Examples</h2> |
| 20 | + <p>The following example can be seen as a <a href="../../working-examples/css-sufficient-target-size/">working example</a>.</p> |
| 21 | + <section class="example"> |
| 22 | + <h3>Making pagination links at least 44px wide and 44px high</h3> |
| 23 | + <p>This example uses <code>min-width</code> and <code>min-height</code> on the targets.</p> |
| 24 | + <figure id="pointer-spacing-flex"> |
| 25 | + <img src="img/sufficient-target-size-pagination-navigation.svg" alt="a pagination control with links for the previous page, pages 1 - 5, and the next page. Page 1 is visually highlighted." height="56" width="514"> |
| 26 | + <figcaption>Example of using CSS to ensure sufficiently large target size</figcaption> |
| 27 | + </figure> |
| 28 | + <h4>The HTML</h4> |
| 29 | +<pre><code class="language-html"><nav aria-label="pagination"> |
| 30 | + <ol class="pagination-list"> |
| 31 | + <li><a>previous</a></li> |
| 32 | + <li><a aria-current="page"><span class="visually-hidden">page </span>1</a></li> |
| 33 | + <li><a href="/page-2"><span class="visually-hidden">page </span>2</a></li> |
| 34 | + <li><a href="/page-3"><span class="visually-hidden">page </span>3</a></li> |
| 35 | + <li><a href="/page-4"><span class="visually-hidden">page </span>4</a></li> |
| 36 | + <li><a href="/page-5"><span class="visually-hidden">page </span>5</a></li> |
| 37 | + <li><a href="/page-2">next</a></li> |
| 38 | + </ol> |
| 39 | +</nav></code></pre> |
| 40 | + <h4>The CSS</h4> |
| 41 | +<pre><code class="language-css">.pagination-list{ |
| 42 | + display: flex; |
| 43 | + gap: 0.5em; |
| 44 | + list-style: none; |
| 45 | + padding: 0; |
| 46 | +} |
| 47 | + |
| 48 | +.pagination-list li{ |
| 49 | + padding: 0.25em; |
| 50 | +} |
| 51 | + |
| 52 | +.pagination-list a{ |
| 53 | + align-items: center; |
| 54 | + display: flex; |
| 55 | + justify-content: center; |
| 56 | + min-height: 44px; |
| 57 | + min-width: 44px; |
| 58 | + padding: 0.5em; |
| 59 | +}</code></pre> |
| 60 | + </section> |
| 61 | + |
| 62 | + </section> |
| 63 | + <section id="tests"> |
| 64 | + <h2>Tests</h2> |
| 65 | + |
| 66 | + <section class="test-procedure"> |
| 67 | + <h3>Procedure</h3> |
| 68 | + |
| 69 | + <p>For each undersized target that has no equivalent, that isn't in a sentence or otherwise constrained by the line-height of non-target text, that hasn't had its size modified by the author, and whose presentation isn't essential:</p> |
| 70 | + <ol> |
| 71 | + <li>Draw a 24px diameter circle centered on the target's bounding box.</li> |
| 72 | + <li>Check that the circle from #1 does not intersect any other target.</li> |
| 73 | + <li>Check that the circle from #1 does not intersect any other undersized target's circle.</li> |
| 74 | + </ol> |
| 75 | + </section> |
| 76 | + <section class="test-results"> |
| 77 | + <h3>Expected Results</h3> |
| 78 | + <ul> |
| 79 | + <li>#2 and #3 are true.</li> |
| 80 | + </ul> |
| 81 | + </section> |
| 82 | + </section> |
| 83 | + <section id="related"> |
| 84 | + <h2>Related Techniques</h2> |
| 85 | + <ul> |
| 86 | + <li><a href="C42">C42</a></li> |
| 87 | + </ul> |
| 88 | + |
| 89 | + </section> |
| 90 | + <!-- <section id="resources"> |
| 91 | + <h2>Resources</h2> |
| 92 | + </section> --> |
| 93 | + </body> |
| 94 | +</html> |
0 commit comments