Skip to content

Commit

Permalink
Hide time controls arrow buttons to screen readers
Browse files Browse the repository at this point in the history
  • Loading branch information
ZEBAS204 committed Mar 28, 2023
1 parent a4b6e4d commit efa3a87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/__tests__/components/timer/TimePicker.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ describe('Time Picker', () => {
)
})

const button = screen.getAllByRole('button')
const button = screen.getAllByRole('button', {
// This buttion has aria-hidden to prevent being accessible to screen readers
// it's not hidden but needs this property to be pick by the role selector
hidden: true,
})

// First button increases time
fireEvent.click(button[0])
Expand Down
9 changes: 8 additions & 1 deletion src/components/timer/TimePicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,14 @@ const Heading = (props) => (
)

const ArrowButton = ({ asIcon, onClick }) => (
<Button variant="ghost" size="xs" w="90%" onClick={onClick} tabIndex="-1">
<Button
variant="ghost"
size="xs"
w="90%"
onClick={onClick}
tabIndex="-1"
aria-hidden
>
<Icon as={asIcon} w={6} h={6} />
</Button>
)
Expand Down

1 comment on commit efa3a87

@vercel
Copy link

@vercel vercel bot commented on efa3a87 Mar 28, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.