Skip to content

Commit

Permalink
Ensure Popover doesn't crash when focus is going to window (#2019)
Browse files Browse the repository at this point in the history
* ensure Popover doesn't crash when `focus` is going to `window`

* update changelog
  • Loading branch information
RobinMalfait committed Nov 16, 2022
1 parent f0dd25f commit a4c7cab
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/@headlessui-react/CHANGELOG.md
Expand Up @@ -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

Expand Down
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions packages/@headlessui-vue/CHANGELOG.md
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions packages/@headlessui-vue/src/components/popover/popover.ts
Expand Up @@ -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

Expand Down

0 comments on commit a4c7cab

Please sign in to comment.