From ba035efc912407c1f03f8a1bd453ca2becb55049 Mon Sep 17 00:00:00 2001 From: nixocio Date: Wed, 2 Feb 2022 11:43:35 -0500 Subject: [PATCH] Fix typerror cannot read property of null ``` > x = null null > x?.contains undefined > x.contains Uncaught TypeError: Cannot read property 'contains' of null ``` See: https://github.com/ansible/awx/issues/11582 --- awx/ui/src/components/AddDropDownButton/AddDropDownButton.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/src/components/AddDropDownButton/AddDropDownButton.js b/awx/ui/src/components/AddDropDownButton/AddDropDownButton.js index b240450bb7..18a0eb8326 100644 --- a/awx/ui/src/components/AddDropDownButton/AddDropDownButton.js +++ b/awx/ui/src/components/AddDropDownButton/AddDropDownButton.js @@ -12,7 +12,7 @@ function AddDropDownButton({ dropdownItems, ouiaId }) { useEffect(() => { const toggle = (e) => { - if (!isKebabified && (!element || !element.current.contains(e.target))) { + if (!isKebabified && (!element || !element.current?.contains(e.target))) { setIsOpen(false); } };