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

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}