Skip to content

An opinionated toast component for React.

fix(typerror): fix unhandled possible undefined of ref #62 (#63)

Olivierd4e0bee8231e
diff --git a/src/index.tsx b/src/index.tsx
index 333a8a7..65b6e5b 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -444,7 +444,7 @@ const Toaster = (props: ToasterProps) => {
if (
event.code === 'Escape' &&
- (document.activeElement === listRef.current || listRef.current.contains(document.activeElement))
+ (document.activeElement === listRef.current || listRef.current?.contains(document.activeElement))
) {
setExpanded(false);
}