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

Fix #3259: TabView add aria-labels to previous and next button #3262

Merged
merged 1 commit into from
Sep 8, 2022
Merged
Changes from all 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
16 changes: 4 additions & 12 deletions components/lib/tabview/TabView.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import * as React from 'react';
import { ariaLabel } from '../api/Api';
import { Button } from '../button/Button';
import { useMountEffect, useUpdateEffect } from '../hooks/Hooks';
import { Ripple } from '../ripple/Ripple';
import { classNames, DomHandler, ObjectUtils, UniqueComponentId } from '../utils/Utils';
Expand Down Expand Up @@ -248,25 +250,15 @@ export const TabView = React.forwardRef((props, ref) => {

const createPrevButton = () => {
if (props.scrollable && !backwardIsDisabledState) {
return (
<button ref={prevBtnRef} className="p-tabview-nav-prev p-tabview-nav-btn p-link" onClick={navBackward} type="button">
<span className="pi pi-chevron-left"></span>
<Ripple />
</button>
);
return <Button ref={prevBtnRef} type="button" className="p-tabview-nav-prev p-tabview-nav-btn p-link" icon="pi pi-chevron-left" onClick={navBackward} aria-label={ariaLabel('previousPageLabel')} />;
}

return null;
};

const createNextButton = () => {
if (props.scrollable && !forwardIsDisabledState) {
return (
<button ref={nextBtnRef} className="p-tabview-nav-next p-tabview-nav-btn p-link" onClick={navForward} type="button">
<span className="pi pi-chevron-right"></span>
<Ripple />
</button>
);
return <Button ref={nextBtnRef} type="button" className="p-tabview-nav-next p-tabview-nav-btn p-link" icon="pi pi-chevron-right" onClick={navForward} aria-label={ariaLabel('nextPageLabel')} />;
}
};

Expand Down