Skip to content

Commit 1b561fc

Browse files
Gary Hemstockdiasbruno
Gary Hemstock
authored andcommitted
[fixed] if tabbable element is undefined, focus head or tail based on shiftKey
1 parent 86632aa commit 1b561fc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Diff for: src/helpers/scopeTab.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,13 @@ export default function scopeTab(node, event) {
6363
}
6464

6565
// If the tabbable element does not exist,
66-
// let the browser control the focus
67-
if (typeof tabbable[x] === "undefined") return;
66+
// focus head/tail based on shiftKey
67+
if (typeof tabbable[x] === "undefined") {
68+
event.preventDefault();
69+
target = shiftKey ? tail : head;
70+
target.focus();
71+
return;
72+
}
6873

6974
event.preventDefault();
7075

0 commit comments

Comments
 (0)