Skip to content

Commit

Permalink
refactor: Add a11y props to default button (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
untemps authored Jun 5, 2020
1 parent 04bcf78 commit abab301
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Vocal.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import MicrophoneIcon from './MicrophoneIcon'
const Vocal = ({
children,
timeout,
ariaLabel,
tabIndex,
style,
className,
onStart,
Expand Down Expand Up @@ -134,6 +136,9 @@ const Vocal = ({
const _renderDefault = () => (
<div
data-testid="__vocal-root__"
role="button"
aria-label={ariaLabel}
tabIndex={tabIndex}
style={className ? null : { width: 24, height: 24, cursor: !isListening ? 'pointer' : null, ...style }}
className={className}
>
Expand All @@ -152,6 +157,10 @@ const Vocal = ({
Vocal.propTypes = {
/** Defines the time in ms to wait before discarding the recognition */
timeout: PropTypes.number,
/** Defines the a11y label for the default button */
ariaLabel: PropTypes.string,
/** Defines the a11y tab index for the default button */
tabIndex: PropTypes.number,
/** Defines the styles of the default element if className is not specified */
style: PropTypes.object,
/** Defines the class of the default element */
Expand All @@ -174,6 +183,8 @@ Vocal.propTypes = {

Vocal.defaultProps = {
timeout: 3000,
ariaLabel: 'speech',
tabIndex: -1,
style: null,
className: null,
onStart: null,
Expand Down

0 comments on commit abab301

Please sign in to comment.