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
This commit is contained in:
nixocio 2022-02-02 11:43:35 -05:00
parent 76cfd7784a
commit ba035efc91

View File

@ -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);
}
};