Unknown Your focus-trap must have at least one container with at least one tabbable node in it at all times error

See original GitHub issue

I am using this focus-trap library for my menu, but I am getting the Your focus-trap must have at least one container with at least one tabbable node in it at all times and I can’t see why when I have a single child container and many links within.

<FocusTrap active={menuIsOpen}>
                    <div className="xl:grid xl:grid-cols-24" id="menu">

                        <nav className="xl:col-start-2 xl:col-span-22">
                            <ul className="title-5 text-left space-y-4">
                                {menuItems?.map((item, n) => (
                                    <li key={n}>
                                        <Link href={`/${item.nodeUri}`}><a className="hover:text-blue transition-colors">{item.title}</a></Link>
                                    </li>
                                ))}
                            </ul>
                            <div className="mt-6">
                                <SocialAccounts socialAccounts={socialAccounts} />
                            </div>
                        </nav>

                        <button className="absolute -transform-x-1/2 flex items-center justify-center bg-deep-600 bg-opacity-30 top-6 right-6 xl:top-12 xl:right-12 hover:bg-opacity-100 transition-colors rounded-md w-12 h-12 md:h-14 md:w-14 xl:w-16 xl:h-16" onClick={()=>{setMenuIsOpen(false)}}>
                            <span className="sr-only">Close menu</span>
                            <XMarkIcon className="h-6 w-6 md:w-8 md:h-8 xl:w-12 xl:h-12" />
                        </button>

                    </div>
                </FocusTrap>

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JayBox325commented, Sep 10, 2022

Thanks, yeah, this is all resolved. Appreciate your help.

1reaction
stefcameroncommented, Sep 8, 2022

@JayBox325 Wonderful! Glad I could help. I’m going to close this issue now since it sounds like you have a solution. All the best!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Your focus-trap must have at least one container with ... - GitHub
Hey there @geniti ! This can happen if there isn't a link/button within the <FocusTrap /> component and there is animations happening that ......
Read more >
Jest error: "Your focus-trap must have at least one container ...
I'm using Jest to write tests for React Components. I can't fix a bug in a component ...
Read more >
focus-trap-react - Bountysource
I am using this focus-trap library for my menu, but I am getting the Your focus-trap must have at least one container with...
Read more >
ERROR Error: You can't have a focus-trap without at least one ...
I got this error in my Angular code for opening a material design dialog(MDCDialog), but I have no clue at the first glance....
Read more >
No longer working – uncaught error - WordPress.org
Uncaught Error: Your focus-trap must have at least one container with at least one tabbable node in it at all times w ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found