your focus-trap must have at least one container with at least one tabbable node focus-trap #896
-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
@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 This happens often when people have traps related to elements that appear and disappear dynamically. Typically, the error will fire either as the element is being shown (because the trap gets created before the trapped children have been inserted into the DOM), or as it's being hidden (because the trapped children are destroyed before the trap is either destroyed or disabled). I have yet to see it related to browser vendors or versions. |
Beta Was this translation helpful? Give feedback.
@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 hastabindex="-1"
, making it focusable, but not tabbable), you will get this error.This happens often when people have traps rela…