Ensure Popover doesn't crash when focus is going to window (#2019)

* ensure Popover doesn't crash when `focus` is going to `window`

* update changelog
This commit is contained in:
Robin Malfait
2022-11-16 15:11:01 +01:00
committed by GitHub
parent f0dd25fbab
commit a4c7cab8a7
4 changed files with 4 additions and 0 deletions
@@ -281,6 +281,7 @@ let PopoverRoot = forwardRefWithAs(function Popover<
if (isFocusWithinPopoverGroup()) return
if (!button) return
if (!panel) return
if (event.target === window) return
if (beforePanelSentinel.current?.contains?.(event.target as HTMLElement)) return
if (afterPanelSentinel.current?.contains?.(event.target as HTMLElement)) return