Skip to content

Commit

Permalink
Close toast when action is clicked
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Perez <60019601+josh-signal@users.noreply.github.com>
  • Loading branch information
automated-signal and josh-signal committed Oct 21, 2021
1 parent f5c1bb1 commit e83eae0
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ts/components/Toast.tsx
Expand Up @@ -91,12 +91,14 @@ export const Toast = memo(
ev.stopPropagation();
ev.preventDefault();
toastAction.onClick();
onClose();
}}
onKeyDown={(ev: KeyboardEvent<HTMLDivElement>) => {
if (ev.key === 'Enter' || ev.key === ' ') {
ev.stopPropagation();
ev.preventDefault();
toastAction.onClick();
onClose();
}
}}
ref={focusRef}
Expand Down

0 comments on commit e83eae0

Please sign in to comment.