Skip to content

Commit

Permalink
feat(Timeline): Add aria-label to buttons
Browse files Browse the repository at this point in the history
Navigation buttons require some text which can be
read by a screenreader.
  • Loading branch information
thyhjwb6 committed Sep 7, 2020
1 parent 8bcbc67 commit eeb4c9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,18 @@ export const TimelineMonths: React.FC<TimelineMonthsProps> = ({ render }) => (
renderRowHeader={(name) => (
<>
<div
aria-hidden
className="timeline__navigation"
data-testid="timeline-navigation"
>
<Button
aria-label="Navigate left"
variant="secondary"
icon={<IconChevronLeft />}
onClick={(_) => dispatch({ type: TIMELINE_ACTIONS.GET_PREV })}
data-testid="timeline-side-button-left"
/>
<Button
aria-label="Navigate right"
variant="secondary"
icon={<IconChevronRight />}
onClick={(_) => dispatch({ type: TIMELINE_ACTIONS.GET_NEXT })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,14 @@ describe('Timeline', () => {
expect(rowHeaders[4]).toHaveTextContent('Row 2')
})

it('should set the `aria-hidden` to `true` for the timeline navigation', () => {
expect(wrapper.getByTestId('timeline-navigation')).toHaveAttribute(
'aria-hidden',
'true'
it('should set the `aria-label` attributes for the timeline navigation buttons', () => {
expect(wrapper.getByTestId('timeline-side-button-left')).toHaveAttribute(
'aria-label',
'Navigate left'
)
expect(wrapper.getByTestId('timeline-side-button-right')).toHaveAttribute(
'aria-label',
'Navigate right'
)
})

Expand Down

0 comments on commit eeb4c9f

Please sign in to comment.