Skip to content

Commit

Permalink
Add accessibility 🍾 realte to issue fkhadra#121
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Jan 23, 2018
1 parent 8f950a9 commit 08a1ab0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/DefaultTransition.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function DefaultTransition({ children, position, ...props }) {
{...props}
timeout={750}
onEnter={node => node.classList.add(enter)}
onEntered={node => node.classList.remove(enter)}
onExit={node => node.classList.add(exit)}
>
{children}
Expand Down
10 changes: 7 additions & 3 deletions src/Toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ class Toast extends Component {
PropTypes.string,
PropTypes.object
]),
updateId: PropTypes.number
updateId: PropTypes.number,
ariaLabel: PropTypes.string
};

static defaultProps = {
Expand All @@ -75,7 +76,8 @@ class Toast extends Component {
className: '',
bodyClassName: '',
progressClassName: '',
updateId: null
updateId: null,
role: 'alert'
};

state = {
Expand Down Expand Up @@ -138,7 +140,8 @@ class Toast extends Component {
className,
bodyClassName,
progressClassName,
updateId
updateId,
role
} = this.props;

return (
Expand All @@ -156,6 +159,7 @@ class Toast extends Component {
{...this.getToastProps()}
>
<div
{...this.props.in && { role: role }}
{...(typeof bodyClassName !== 'string'
? css(styles.body, bodyClassName)
: styles.body)}
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/__snapshots__/Toast.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ exports[`Toast Should allow glamor rule as className 1`] = `
>
<div
data-css-6qy7r3=""
role="alert"
>
FooBar
</div>
Expand Down

0 comments on commit 08a1ab0

Please sign in to comment.