Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a11y rework of [EuiPagination] and friends #3294

Merged
merged 12 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@
- Added support for `EuiCodeEditor` to set `readonly` and `id` on `<textarea />` ([#3212](https://github.com/elastic/eui/pull/3212))
- Added `EuiComment` component ([#3179](https://github.com/elastic/eui/pull/3179))

**Breaking changes**
- Improved `EuiPagination`, `EuiDataGrid`, `EuiBasicTable` and `EuiInMemoryTable` accessibility, causing `EuiPaginationButton` to require a new prop `pageIndex` ([#3294](https://github.com/elastic/eui/pull/3294))

**Deprecation**

- Updated makeId to DEPRECATED, shifted all the calls to htmlIdGenerator ([#3129](https://github.com/elastic/eui/pull/3129))
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/components/guide_page/guide_page_chrome.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export class GuidePageChrome extends Component {
toggleOpenOnMobile={this.toggleOpenOnMobile}
isOpenOnMobile={this.state.isSideNavOpenOnMobile}
items={sideNav}
aria-label="Primary"
/>
);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/additional_controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default () => {

return (
<EuiDataGrid
aria-label="Top EUI contributors"
aria-label="Data grid demo with additional controls"
columns={columns}
columnVisibility={{
visibleColumns: visibleColumns,
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export default () => {
<EuiPanel style={{ width: 400, paddingBottom: 4 }} paddingSize="none">
<div style={{ height: 300 }}>
<EuiDataGrid
aria-label="Top EUI contributors"
aria-label="Container constrained data grid demo"
columns={columns}
columnVisibility={{
visibleColumns: visibleColumns,
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/in_memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default () => {

return (
<EuiDataGrid
aria-label="Data grid demo"
aria-label="inMemory level defaulting to undefined data grid demo"
columns={columns}
columnVisibility={{ visibleColumns, setVisibleColumns }}
rowCount={raw_data.length}
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/in_memory_pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export default () => {

return (
<EuiDataGrid
aria-label="Data grid demo"
aria-label="inMemory level set to pagination data grid demo"
columns={columns}
columnVisibility={{ visibleColumns, setVisibleColumns }}
rowCount={raw_data.length}
Expand Down
2 changes: 1 addition & 1 deletion src-docs/src/views/datagrid/in_memory_sorting.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export default () => {

return (
<EuiDataGrid
aria-label="Data grid demo"
aria-label="inMemory level set to sorting data grid demo"
columns={columns}
columnVisibility={{ visibleColumns, setVisibleColumns }}
rowCount={raw_data.length}
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/pagination/centered_pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function() {
<EuiFlexGroup justifyContent="spaceAround">
<EuiFlexItem grow={false}>
<EuiPagination
aria-label="Centered pagination example"
pageCount={PAGE_COUNT}
activePage={activePage}
onPageClick={activePage => goToPage(activePage)}
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/pagination/customizable_pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export default () => {

<EuiFlexItem grow={false}>
<EuiPagination
aria-label="Custom pagination example"
pageCount={PAGE_COUNT}
activePage={activePage}
onPageClick={goToPage}
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/pagination/few_pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function() {

return (
<EuiPagination
aria-label="Few pages example"
pageCount={PAGE_COUNT}
activePage={activePage}
onPageClick={activePage => goToPage(activePage)}
Expand Down
1 change: 1 addition & 0 deletions src-docs/src/views/pagination/many_pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default function() {

return (
<EuiPagination
aria-label="Many pages example"
pageCount={PAGE_COUNT}
activePage={activePage}
onPageClick={activePage => goToPage(activePage)}
Expand Down
5 changes: 5 additions & 0 deletions src-docs/src/views/pagination/pagination_example.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import ManyPages from './many_pages';
const manyPagesSource = require('!!raw-loader!./many_pages');
const manyPagesHtml = renderToHtml(ManyPages);
const manyPagesSnippet = `<EuiPagination
aria-label="my pagination"
pageCount={higherThan5Number}
activePage={activePage}
onPageClick={goToPage}
Expand All @@ -25,6 +26,7 @@ import FewPages from './few_pages';
const fewPagesSource = require('!!raw-loader!./few_pages');
const fewPagesHtml = renderToHtml(FewPages);
const fewPagesSnippet = `<EuiPagination
aria-label="my pagination"
pageCount={lowerThan5Number}
activePage={activePage}
onPageClick={goToPage}
Expand All @@ -37,6 +39,7 @@ const centeredPaginationHtml = renderToHtml(CenteredPagination);
const centeredPaginationSnippet = `<EuiFlexGroup justifyContent="spaceAround">
<EuiFlexItem grow={false}>
<EuiPagination
aria-label="my pagination"
pageCount={pageCount}
activePage={activePage}
onPageClick={goToPage}
Expand All @@ -60,6 +63,7 @@ const customizablePaginationSnippet = `<EuiFlexGroup justifyContent="spaceBetwee

<EuiFlexItem grow={false}>
<EuiPagination
aria-label="my pagination"
pageCount={pageCount}
activePage={activePage}
onPageClick={goToPage}
Expand All @@ -72,6 +76,7 @@ import Compressed from './compressed';
const compressedSource = require('!!raw-loader!./compressed');
const compressedHtml = renderToHtml(Compressed);
const compressedSnippet = `<EuiPagination
aria-label="my pagination"
pageCount={pageCount}
activePage={activePage}
onPageClick={goToPage}
Expand Down
4 changes: 3 additions & 1 deletion src-docs/src/views/tables/custom/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ export default class extends Component {

render() {
let optionalActionButtons;
const exampleId = 'example-id';

if (this.areAnyRowsSelected() > 0) {
optionalActionButtons = (
Expand Down Expand Up @@ -718,7 +719,7 @@ export default class extends Component {
</EuiFlexGroup>
</EuiTableHeaderMobile>

<EuiTable>
<EuiTable id={exampleId}>
<EuiTableHeader>{this.renderHeaderCells()}</EuiTableHeader>

<EuiTableBody>{this.renderRows()}</EuiTableBody>
Expand All @@ -729,6 +730,7 @@ export default class extends Component {
<EuiSpacer size="m" />

<EuiTablePagination
aria-controls={exampleId}
activePage={this.pager.getCurrentPageIndex()}
itemsPerPage={this.state.itemsPerPage}
itemsPerPageOptions={[5, 10, 20]}
Expand Down
Loading