Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Window losing focus while Popover is open throws errors #2018

Closed
RonnyLark opened this issue Nov 16, 2022 · 2 comments · Fixed by #2019
Closed

Window losing focus while Popover is open throws errors #2018

RonnyLark opened this issue Nov 16, 2022 · 2 comments · Fixed by #2019
Assignees

Comments

@RonnyLark
Copy link

RonnyLark commented Nov 16, 2022

What package within Headless UI are you using?

@headlessui/react

What version of that package are you using?

Most recent (1.7.4)

What browser are you using?

Chrome

Reproduction URL

https://codesandbox.io/s/busy-rgb-r7boos?file=/src/App.tsx

Describe your issue

When using Popover, if the popover is open, and focus is taken away from the window, and is then returned to the window, an uncaught error is thrown.

Steps to reproduce in the sandbox above:

  1. Click "Click me!".
  2. A popover with the text "I am content" is opened.
  3. Click away from the iframe (i.e. click the code to the left).
  4. Click back on the iframe.
  5. The following error is thrown:
Failed to execute 'contains' on 'Node': parameter 1 is not of type 'Node'.

This happens in non-iframe browsers as well.

Applying focus to the Popover.Panel doesn't help, as it doesn't trigger when the window loses focus.

@RobinMalfait
Copy link
Collaborator

Hey! Thank you for your bug report!
Much appreciated! 🙏

This should be fixed by #2019, and will be available in the next release.

You can already try it using:

  • npm install @headlessui/react@insiders.
  • npm install @headlessui/vue@insiders.

I also updated your CodeSandbox link with the latest insiders build: https://codesandbox.io/s/nifty-chebyshev-hzkuyr?file=/package.json

Thanks!

@RonnyLark
Copy link
Author

Holy moly that was fast! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants