Skip to content

Commit

Permalink
Fix primefaces#2827: Paginator accessible buttons (primefaces#2828)
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware authored May 2, 2022
1 parent 281a993 commit 4f04f11
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 24 deletions.
2 changes: 2 additions & 0 deletions components/lib/api/Locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ let locales = {
falseLabel: 'False',
nullLabel: 'Not Selected',
pageLabel: 'Page',
firstPageLabel: 'First Page',
lastPageLabel: 'Last Page',
nextPageLabel: 'Next Page',
previousPageLabel: 'Previous Page'
}
Expand Down
8 changes: 3 additions & 5 deletions components/lib/paginator/FirstPageLink.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import * as React from 'react';
import { Ripple } from '../ripple/Ripple';
import { ariaLabel } from '../api/Api';
import { Button } from '../button/Button';
import { classNames, ObjectUtils } from '../utils/Utils';

export const FirstPageLink = React.memo((props) => {
const className = classNames('p-paginator-first p-paginator-element p-link', { 'p-disabled': props.disabled });
const iconClassName = 'p-paginator-icon pi pi-angle-double-left';
const element = (
<button type="button" className={className} onClick={props.onClick} disabled={props.disabled}>
<span className={iconClassName}></span>
<Ripple />
</button>
<Button className={className} icon={iconClassName} onClick={props.onClick} disabled={props.disabled} aria-label={ariaLabel('firstPageLabel')}/>
);

if (props.template) {
Expand Down
8 changes: 3 additions & 5 deletions components/lib/paginator/LastPageLink.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import * as React from 'react';
import { Ripple } from '../ripple/Ripple';
import { ariaLabel } from '../api/Api';
import { Button } from '../button/Button';
import { classNames, ObjectUtils } from '../utils/Utils';

export const LastPageLink = React.memo((props) => {
const className = classNames('p-paginator-last p-paginator-element p-link', { 'p-disabled': props.disabled });
const iconClassName = 'p-paginator-icon pi pi-angle-double-right';
const element = (
<button type="button" className={className} onClick={props.onClick} disabled={props.disabled}>
<span className={iconClassName}></span>
<Ripple />
</button>
<Button className={className} icon={iconClassName} onClick={props.onClick} disabled={props.disabled} aria-label={ariaLabel('lastPageLabel')}/>
);

if (props.template) {
Expand Down
8 changes: 3 additions & 5 deletions components/lib/paginator/NextPageLink.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import * as React from 'react';
import { Ripple } from '../ripple/Ripple';
import { ariaLabel } from '../api/Api';
import { Button } from '../button/Button';
import { classNames, ObjectUtils } from '../utils/Utils';

export const NextPageLink = React.memo((props) => {
const className = classNames('p-paginator-next p-paginator-element p-link', { 'p-disabled': props.disabled });
const iconClassName = 'p-paginator-icon pi pi-angle-right';
const element = (
<button type="button" className={className} onClick={props.onClick} disabled={props.disabled}>
<span className={iconClassName}></span>
<Ripple />
</button>
<Button className={className} icon={iconClassName} onClick={props.onClick} disabled={props.disabled} aria-label={ariaLabel('nextPageLabel')}/>
);

if (props.template) {
Expand Down
8 changes: 4 additions & 4 deletions components/lib/paginator/PageLinks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as React from 'react';
import { Ripple } from '../ripple/Ripple';
import { ariaLabel } from '../api/Api';
import { Button } from '../button/Button';
import { classNames, ObjectUtils } from '../utils/Utils';

export const PageLinks = React.memo((props) => {
Expand Down Expand Up @@ -29,10 +30,9 @@ export const PageLinks = React.memo((props) => {
});

let element = (
<button type="button" className={className} onClick={(e) => onPageLinkClick(e, pageLink)}>
<Button className={className} onClick={(e) => onPageLinkClick(e, pageLink)} aria-label={`${ariaLabel('pageLabel')} ${pageLink + 1}`}>
{pageLink}
<Ripple />
</button>
</Button>
);

if (props.template) {
Expand Down
8 changes: 3 additions & 5 deletions components/lib/paginator/PrevPageLink.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import * as React from 'react';
import { Ripple } from '../ripple/Ripple';
import { ariaLabel } from '../api/Api';
import { Button } from '../button/Button';
import { classNames, ObjectUtils } from '../utils/Utils';

export const PrevPageLink = React.memo((props) => {
const className = classNames('p-paginator-prev p-paginator-element p-link', { 'p-disabled': props.disabled });
const iconClassName = 'p-paginator-icon pi pi-angle-left';
const element = (
<button type="button" className={className} onClick={props.onClick} disabled={props.disabled}>
<span className={iconClassName}></span>
<Ripple />
</button>
<Button className={className} icon={iconClassName} onClick={props.onClick} disabled={props.disabled} aria-label={ariaLabel('previousPageLabel')}/>
);

if (props.template) {
Expand Down

0 comments on commit 4f04f11

Please sign in to comment.