From b0363c0b2350a842f13e5ab38e1e33490e1c5d70 Mon Sep 17 00:00:00 2001 From: Szymon Wiszczuk <37072867+golota60@users.noreply.github.com> Date: Thu, 24 Jun 2021 01:56:25 +0200 Subject: [PATCH] fix(Dropdown): add checking if ref exists on dropdown (#958) * fix: add checking if ref exists on dropdown * Update src/Dropdown.tsx Co-authored-by: Jason Quense * linting Co-authored-by: Jason Quense --- src/Dropdown.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Dropdown.tsx b/src/Dropdown.tsx index d988edd4..be6a7c31 100644 --- a/src/Dropdown.tsx +++ b/src/Dropdown.tsx @@ -278,7 +278,7 @@ function Dropdown({ (e) => { if ( (e.key === 'Tab' && !e.target) || - !menuRef.current!.contains(e.target as HTMLElement) + !menuRef.current?.contains(e.target as HTMLElement) ) { onToggle(false, event); }