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

Add FocusTrap event listeners once document has loaded #2389

Merged

Conversation

KairuiLiu
Copy link
Contributor

@KairuiLiu KairuiLiu commented Mar 21, 2023

This PR fixes an issue where some event listeners in the FocusTrap component were added prematurely and could crash. This PR ensures that the document itself is ready before trying to attach these events.

If the events are added a little bit later it's not a super big deal.


Lazy loading event listeners. See: #2387 (comment)

@vercel
Copy link

vercel bot commented Mar 21, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated
headlessui-react ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 22, 2023 at 0:35AM (UTC)
headlessui-vue ✅ Ready (Inspect) Visit Preview 💬 Add your feedback Mar 22, 2023 at 0:35AM (UTC)

@vercel
Copy link

vercel bot commented Mar 21, 2023

Someone is attempting to deploy a commit to the Tailwind Labs Team on Vercel.

A member of the Team first needs to authorize it.

@RobinMalfait RobinMalfait changed the title feat: addEventListener on document loaded Add FocusTrap event listeners once document has loaded Mar 22, 2023
@RobinMalfait
Copy link
Member

Thanks @KairuiLiu and @thecrypticace!

I made a small change by making the cb mandatory.

@thecrypticace
Copy link
Contributor

ah whoops good catch!

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 this pull request may close these issues.

3 participants