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:
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
- Reset form-like components when the parent `<form>` resets ([#2004](https://github.com/tailwindlabs/headlessui/pull/2004))
|
||||
- Add warning when using `<Popover.Button />` multiple times ([#2007](https://github.com/tailwindlabs/headlessui/pull/2007))
|
||||
- Ensure Popover doesn't crash when `focus` is going to `window` ([#2019](https://github.com/tailwindlabs/headlessui/pull/2019))
|
||||
|
||||
## [1.7.4] - 2022-11-03
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Fixed
|
||||
|
||||
- Reset form-like components when the parent `<form>` resets ([#2004](https://github.com/tailwindlabs/headlessui/pull/2004))
|
||||
- Ensure Popover doesn't crash when `focus` is going to `window` ([#2019](https://github.com/tailwindlabs/headlessui/pull/2019))
|
||||
|
||||
## [1.7.4] - 2022-11-03
|
||||
|
||||
|
||||
@@ -223,6 +223,7 @@ export let Popover = defineComponent({
|
||||
if (isFocusWithinPopoverGroup()) return
|
||||
if (!button) return
|
||||
if (!panel) return
|
||||
if (event.target === window) return
|
||||
if (dom(api.beforePanelSentinel)?.contains(event.target as HTMLElement)) return
|
||||
if (dom(api.afterPanelSentinel)?.contains(event.target as HTMLElement)) return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user