Skip to content

Commit

Permalink
a11y for paginator
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed May 30, 2022
1 parent aaa589a commit e712033
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions components/doc/paginator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Link from 'next/link';
import { TabView, TabPanel } from '../../lib/tabview/TabView';
import { useLiveEditorTabs } from '../common/liveeditor';
import { CodeHighlight } from '../common/codehighlight';
import { DevelopmentSection } from '../common/developmentsection';

const PaginatorDoc = memo(() => {

Expand Down Expand Up @@ -1164,11 +1165,57 @@ const template = {
</tr>
</tbody>
</table>

<h5>Dependencies</h5>
<p>None.</p>
</div>

<h5>Accessibility</h5>
<DevelopmentSection>
<h6>Screen Reader</h6>
<p>Paginator is placed inside a <i>nav</i> element to indicate a navigation section. All of the paginator elements can be customized using templating however the default behavious is listed below.</p>

<p>First, previous, next and last page navigators elements with <i>aria-label</i> attributes referring to the <i>aria.firstPageLabel</i>, <i>aria.prevPageLabel</i>, <i>aria.nextPageLabel</i> and <i>aria.lastPageLabel</i>
properties of the <Link href="/locale">locale</Link> API respectively.</p>

<p>Page links are also button elements with an <i>aria-label</i> attribute derived from the <i>aria.pageLabel</i> of the <Link href="/locale">locale</Link> API. Current page is marked with <i>aria-current</i> set to "page" as well.</p>

<p>Current page report uses <i>aria-live="polite"</i> to instruct screen reader about the changes to the pagination state.</p>

<p>Rows per page dropdown internally uses a dropdown component, refer to the <Link href="/dropdown">dropdown</Link> documentation for accessibility details. Additionally, the dropdown uses an <i>aria-label</i>
from the <i>aria.rowsPerPage</i> property of the <Link href="/locale">locale</Link> API.</p>

<p>Jump to page input is an <i>input</i> element with an <i>aria-label</i> that refers to the <i>aria.jumpToPage</i> property of the <Link href="/locale">locale</Link> API.</p>

<h6>Keyboard Support</h6>
<div className="doc-tablewrapper">
<table className="doc-table">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr>
<td><i>tab</i></td>
<td>Moves focus through the paginator elements.</td>
</tr>
<tr>
<td><i>enter</i></td>
<td>Executes the paginator element action.</td>
</tr>
<tr>
<td><i>space</i></td>
<td>Executes the paginator element action.</td>
</tr>
</tbody>
</table>
</div>

<h6>Rows Per Page Dropdown Keyboard Support</h6>
<p>Refer to the <Link href="/dropdown">dropdown</Link> documentation for more details about keyboard support.</p>
</DevelopmentSection>

<h5>Dependencies</h5>
<p>None.</p>
</TabPanel>

{
Expand Down

0 comments on commit e712033

Please sign in to comment.