@zag-js/tabbable
Advanced tools
Comparing version 0.0.0-dev-20230321203218 to 0.0.0-dev-20230322194557
@@ -127,8 +127,9 @@ "use strict"; | ||
let elementToFocus = null; | ||
const [firstTabbable, lastTabbable] = getTabbableEdges(container); | ||
if (event.shiftKey && doc.activeElement === firstTabbable) { | ||
const [firstTabbable, lastTabbable] = getTabbableEdges(container, true); | ||
const noTabbableElements = !firstTabbable && !lastTabbable; | ||
if (event.shiftKey && (doc.activeElement === firstTabbable || noTabbableElements)) { | ||
elementToFocus = reference; | ||
} else if (!event.shiftKey && doc.activeElement === reference) { | ||
elementToFocus = firstTabbable; | ||
} else if (!event.shiftKey && doc.activeElement === lastTabbable) { | ||
} else if (!event.shiftKey && (doc.activeElement === lastTabbable || noTabbableElements)) { | ||
elementToFocus = getNextTabbable(body, reference); | ||
@@ -135,0 +136,0 @@ } |
{ | ||
"name": "@zag-js/tabbable", | ||
"version": "0.0.0-dev-20230321203218", | ||
"version": "0.0.0-dev-20230322194557", | ||
"description": "Small utility that returns an array of all* tabbable DOM nodes within a containing node.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
15716
325