Skip to content

Commit

Permalink
Merge pull request #18143 from mozilla/FXA-10874
Browse files Browse the repository at this point in the history
fix(react): Ensure document.body is defined before removing event listener
  • Loading branch information
LZoog authored Dec 18, 2024
2 parents 1453068 + d63f270 commit cb05497
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/fxa-react/lib/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function useClickOutsideEffect<T>(onClickOutside: Function) {
}
};
document.body.addEventListener('click', onBodyClick);
return () => document.body.removeEventListener('click', onBodyClick);
return () => document.body?.removeEventListener('click', onBodyClick);
}, [onClickOutside]);

return insideEl;
Expand Down

0 comments on commit cb05497

Please sign in to comment.