Close toast when action is clicked

This commit is contained in:
Josh Perez 2021-10-21 16:14:26 -04:00 committed by GitHub
parent 1b1ed2cd05
commit dc5a17e962
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -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}