Skip to content

Commit

Permalink
Safety check for use of ref in useDropdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sirugh committed Nov 5, 2019
1 parent 1c67fd3 commit 18b3479
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/peregrine/lib/hooks/useDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const useDropdown = () => {

// collapse on mousedown outside of this element
const maybeCollapse = useCallback(({ target }) => {
if (!elementRef.current.contains(target)) {
if (elementRef.current && !elementRef.current.contains(target)) {
setExpanded(false);
}
}, []);
Expand Down

0 comments on commit 18b3479

Please # to comment.