From 1b561fc54f107df583281667eb92e7975ec33ba8 Mon Sep 17 00:00:00 2001 From: Gary Hemstock Date: Wed, 26 Sep 2018 13:07:52 -0400 Subject: [PATCH] [fixed] if tabbable element is undefined, focus head or tail based on shiftKey --- src/helpers/scopeTab.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/helpers/scopeTab.js b/src/helpers/scopeTab.js index b8516c4d..16513c19 100644 --- a/src/helpers/scopeTab.js +++ b/src/helpers/scopeTab.js @@ -63,8 +63,13 @@ export default function scopeTab(node, event) { } // If the tabbable element does not exist, - // let the browser control the focus - if (typeof tabbable[x] === "undefined") return; + // focus head/tail based on shiftKey + if (typeof tabbable[x] === "undefined") { + event.preventDefault(); + target = shiftKey ? tail : head; + target.focus(); + return; + } event.preventDefault();