Skip to content

your focus-trap must have at least one container with at least one tabbable node focus-trap #896

Answered by stefcameron
NicolasLaverde asked this question in Q&A
Discussion options

You must be logged in to vote

@NicolasLaverde Many people run into this error, unfortunately. It happens when the containers you gave when you setup your focus trap do not have -- or no longer have -- any tabbable elements in them, which means that focus will inevitably escape your trap because focus must always go somewhere.

If your trap does not have (or no longer has) any tabbable (and therefore focusable) elements in it, and it was not configured with a backup element (see the fallbackFocus option -- which must still be in the trap, but does not necessarily have to be tabbable (i.e. it has tabindex="-1", making it focusable, but not tabbable), you will get this error.

This happens often when people have traps rela…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@NicolasLaverde
Comment options

@stefcameron
Comment options

Answer selected by NicolasLaverde
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants