Skip to content

Commit 8c6b693

Browse files
committed
refactor(CDropdown): improve syntax
1 parent bad08ef commit 8c6b693

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/components/dropdown/CDropdown.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,12 @@ export const CDropdown = forwardRef<HTMLDivElement | HTMLLIElement, CDropdownPro
145145
}, [visible])
146146

147147
const handleKeyup = (event: Event) => {
148-
if (dropdownRef.current && !dropdownRef.current.contains(event.target as HTMLElement)) {
148+
if (!dropdownRef.current?.contains(event.target as HTMLElement)) {
149149
setVisible(false)
150150
}
151151
}
152152
const handleClickOutside = (event: Event) => {
153-
if (dropdownRef.current && !dropdownRef.current.contains(event.target as HTMLElement)) {
153+
if (!dropdownRef.current?.contains(event.target as HTMLElement)) {
154154
setVisible(false)
155155
}
156156
}

0 commit comments

Comments
 (0)