Content
View differences
Updated by Alexander Coles 11 months ago
FIx a number of additional accessibility issues and inconsistencies between the `PaginationHelper` (Rails) and `TablePaginationComponent` (ng) implementations.
\----
Similarities and differences in implementations:
## Pagination Items (`<ul>` in `nav.op-pagination--pages`)
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><thead class="op-uc-table--head"><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Aspect</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">ng</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Rails</p></th></tr></thead><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Previous/Next</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><button></code> elements</p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><a></code> | Aspect | ng | Rails |
| ----------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| **Previous/Next** | `<button>` elements | `<a>` links with <code class="op-uc-code">href</code></p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Page numbers</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><button></code> `href` |
| **Page numbers** | `<button>` or <code class="op-uc-code"><em></code></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><a></code> `<em>` | `<a>` or <code class="op-uc-code"><em></code></p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Range display</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><li class="op-pagination--range"><span>(121 `<em>` |
| **Range display** | `<li class="op-pagination--range"><span>(121 - 140/5519)</span></li></code></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><li class="op-pagination--range">(21 140/5519)</span></li>` | `<li class="op-pagination--range">(21 - 40/50)</li></code> 40/50)</li>` — no <code class="op-uc-code"><span></code> wrapper</p></td></tr></tbody></table></figure> `<span>` wrapper |
## Items per page (`div.op-pagination--options`)
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><thead class="op-uc-table--head"><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Aspect</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">ng</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Rails</p></th></tr></thead><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Container</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><ul></code> | Aspect | ng | Rails |
| ----------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| **Container** | `<ul>` with <code class="op-uc-code">role="presentation"</code></p></td><td class="op-uc-table--cell"><p class="op-uc-p">Same</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Label</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><li `role="presentation"` | Same |
| **Label** | `<li class="op-pagination--label" aria-label="Per page:">Per page:</li></code></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><li class="op-pagination--label">Per page:</li></code> page:">Per page:</li>` | `<li class="op-pagination--label">Per page:</li>` (no <code class="op-uc-code">aria-label</code>)</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Selected item</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><li></code> `aria-label`) |
| **Selected item** | `<li>` with <code class="op-uc-code"><span></code></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><li></code> `<span>` | `<li>` with <code class="op-uc-code"><span></code> `<span>` — same</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Other options</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><button></code></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><a></code> same |
| **Other options** | `<button>` | `<a>` with <code class="op-uc-code">href</code> `href` and <code class="op-uc-code">target="_top"</code></p></td></tr></tbody></table></figure> `target="_top"` |
## Attributes
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><thead class="op-uc-table--head"><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Element</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">ng</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Rails</p></th></tr></thead><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Navigation links</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code">type="button"</code>, <code class="op-uc-code">rel="prev/next"</code>, <code class="op-uc-code">aria-label</code> | Element | ng | Rails |
| -------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------- |
| **Navigation links** | `type="button"`, `rel="prev/next"`, `aria-label` on <code class="op-uc-code"><button></code></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code">href</code> `<button>` | `href` attribute present, <code class="op-uc-code">data-turbo-stream="true"</code>, <code class="op-uc-code">rel="prev/next"</code></p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Icons (</strong><code class="op-uc-code"><strong><svg></strong></code><strong>)</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p">Uses <code class="op-uc-code"><svg></code> `data-turbo-stream="true"`, `rel="prev/next"` |
| **Icons (`<svg>`)** | Uses `<svg>` inside <code class="op-uc-code"><button></code></p></td><td class="op-uc-table--cell"><p class="op-uc-p">Uses <code class="op-uc-code"><svg></code> `<button>` | Uses `<svg>` inside <code class="op-uc-code"><a></code></p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Range</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p">Uses <code class="op-uc-code">&nbsp;</code> `<a>` |
| **Range** | Uses ` ` for spacing</p></td><td class="op-uc-table--cell"><p class="op-uc-p">Plain text</p></td></tr><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Per spacing | Plain text |
| **Per page links</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p">Uses <code class="op-uc-code"><button></code></p></td><td class="op-uc-table--cell"><p class="op-uc-p">Uses <code class="op-uc-code"><a href="..."></code> links** | Uses `<button>` | Uses `<a href="...">` with <code class="op-uc-code">target="_top"</code></p></td></tr></tbody></table></figure> `target="_top"` |
\----
Similarities and differences in implementations:
## Pagination Items (`<ul>` in `nav.op-pagination--pages`)
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><thead class="op-uc-table--head"><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Aspect</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">ng</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Rails</p></th></tr></thead><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Previous/Next</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><button></code> elements</p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><a></code>
| ----------------- | --------------------------------------------------------------------- | -------------------------------------------------------------------------- |
| **Previous/Next** | `<button>` elements | `<a>`
| **Page numbers** | `<button>`
| **Range display** | `<li class="op-pagination--range"><span>(121
## Items per page (`div.op-pagination--options`)
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><thead class="op-uc-table--head"><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Aspect</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">ng</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Rails</p></th></tr></thead><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Container</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code"><ul></code>
| ----------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| **Container** | `<ul>`
| **Label** | `<li
| **Selected item** | `<li>`
| **Other options** | `<button>` | `<a>`
## Attributes
<figure class="table op-uc-figure_align-center op-uc-figure"><table class="op-uc-table"><thead class="op-uc-table--head"><tr class="op-uc-table--row"><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Element</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">ng</p></th><th class="op-uc-table--cell op-uc-table--cell_head"><p class="op-uc-p">Rails</p></th></tr></thead><tbody><tr class="op-uc-table--row"><td class="op-uc-table--cell"><p class="op-uc-p"><strong>Navigation links</strong></p></td><td class="op-uc-table--cell"><p class="op-uc-p"><code class="op-uc-code">type="button"</code>, <code class="op-uc-code">rel="prev/next"</code>, <code class="op-uc-code">aria-label</code>
| -------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------- |
| **Navigation links** | `type="button"`, `rel="prev/next"`, `aria-label`
| **Icons (`<svg>`)** | Uses `<svg>`
| **Range** | Uses ` `
| **Per