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

[EuiTablePagination] Add aria-current to rows per page menu #7186

Merged
merged 9 commits into from
Sep 14, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ exports[`EuiTablePagination renders 1`] = `
>
<div>
<button
aria-current="true"
class="euiContextMenuItem"
data-test-subj="tablePagination-10-rows"
type="button"
Expand Down
3 changes: 3 additions & 0 deletions src/components/table/table_pagination/table_pagination.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ export const EuiTablePagination: FunctionComponent<EuiTablePaginationProps> = (
<EuiContextMenuItem
key={itemsPerPageOption}
Copy link
Member

@cee-chen cee-chen Sep 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This key is still needed for .map iteration. You should be see a ton of warnings in the console without it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I re-added the icon and aria-current before the key, so the default PR view shows it removed. The key is still in the code on L#121. I can move it back to previous location.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh whoops, you're right 🤦 yeah let's make the key the first prop as a general rule, it makes it easier to tell it's there since it's a "special" prop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that as an EUI house style and sound argument. I'll move it to the first prop declaration and set auto-merge after the tests run.

icon={itemsPerPageOption === itemsPerPage ? 'check' : 'empty'}
aria-current={
itemsPerPageOption === itemsPerPage ? 'true' : undefined
}
onClick={() => {
closePopover();
onChangeItemsPerPage?.(itemsPerPageOption);
Expand Down
3 changes: 3 additions & 0 deletions upcoming_changelogs/7186.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
**Accessibility**

- Added `aria-current` attribute to `EuiTablePagination`
Loading