ally.js icon indicating copy to clipboard operation
ally.js copied to clipboard

ally.maintain.tabFocus throws error when pressing Tab inside a dialog without focusable elements

Open rafa11rodrigues opened this issue 4 years ago • 0 comments

ally.maintain.tabFocus works pretty well when my dialog has a button, or a input, but if my dialog has only text, console shows error when I press Tab or Shift+Tab.

Here's the error:

Uncaught TypeError: is/active-element requires valid options.context
    at ht (ally.js:51)
    at xt (ally.js:101)
    at HTMLHtmlElement.?alt+?shift+tab (ally.js:4870)
    at ally.js:4825
    at Array.forEach (<anonymous>)
    at HTMLHtmlElement.a (ally.js:4820)
ht @ ally.js:51
xt @ ally.js:101
?alt+?shift+tab @ ally.js:4870
(anonymous) @ ally.js:4825
a @ ally.js:4820

Here is my setup:

const dialog = document.getElementById('dialog');
let nonFocusableNodes = ally.maintain.disabled({
    filter: dialog,
});

let tabKeyHandled = ally.maintain.tabFocus({
    context: dialog,
});

allyJS version: 1.4.1

rafa11rodrigues avatar Feb 08 '21 22:02 rafa11rodrigues