Skip to content

Commit

Permalink
Merge pull request #5764 from ilzamcmed/LPD-17368
Browse files Browse the repository at this point in the history
LPD-17368 Accessibility issue in Pagination Picker
  • Loading branch information
matuzalemsteles authored Feb 19, 2024
2 parents 7dae7b1 + 74f3f21 commit 09ecafc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,8 @@ interface IProps extends React.ComponentProps<typeof PaginationBar> {
* Use this property for i18n.
*/
labels?: {
itemsPerPagePickerAriaLabel?: string;

paginationResults: string;

perPageItems: string;
Expand Down Expand Up @@ -148,6 +150,7 @@ interface IProps extends React.ComponentProps<typeof PaginationBar> {
}

const DEFAULT_LABELS = {
itemsPerPagePickerAriaLabel: 'Items Per Page',
paginationResults: 'Showing {0} to {1} of {2}',
perPageItems: '{0} items',
selectPerPageItems: '{0} items',
Expand Down Expand Up @@ -209,6 +212,8 @@ export const ClayPaginationBarWithBasicItems = ({
value: typeof active === 'undefined' ? activePage : active,
});

labels = {...DEFAULT_LABELS, ...labels};

if (!activeDelta) {
activeDelta = deltas[0]!.label;
}
Expand All @@ -230,6 +235,7 @@ export const ClayPaginationBarWithBasicItems = ({
<Picker
activeDelta={activeDelta}
aria-describedby={ariaDescribedby}
aria-label={labels.itemsPerPagePickerAriaLabel}
as={Trigger}
items={deltas}
labels={labels}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ exports[`ClayPaginationBar renders 1`] = `
aria-describedby="clay-id-1"
aria-expanded="false"
aria-haspopup="listbox"
aria-label="Items Per Page"
class="dropdown-toggle btn btn-unstyled"
role="combobox"
tabindex="0"
Expand Down

0 comments on commit 09ecafc

Please sign in to comment.