@zag-js/interact-outside
Advanced tools
Comparing version 0.0.0-dev-20230225101755 to 0.0.0-dev-20230319234907
@@ -73,2 +73,10 @@ "use strict"; | ||
var FOCUS_OUTSIDE_EVENT = "focus.outside"; | ||
function isComposedPathFocusable(event) { | ||
const composedPath = event.composedPath() ?? [event.target]; | ||
for (const node of composedPath) { | ||
if ((0, import_dom_query.isHTMLElement)(node) && (0, import_tabbable.isFocusable)(node)) | ||
return true; | ||
} | ||
return false; | ||
} | ||
function trackInteractOutside(node, options) { | ||
@@ -106,3 +114,3 @@ const { exclude, onFocusOutside, onPointerDownOutside, onInteractOutside } = options; | ||
contextmenu: (0, import_dom_event.isContextMenuEvent)(event), | ||
focusable: (0, import_tabbable.isFocusable)((0, import_dom_query.getEventTarget)(event)) | ||
focusable: isComposedPathFocusable(event) | ||
} | ||
@@ -109,0 +117,0 @@ }); |
{ | ||
"name": "@zag-js/interact-outside", | ||
"version": "0.0.0-dev-20230225101755", | ||
"version": "0.0.0-dev-20230319234907", | ||
"description": "Track interations or focus outside an element", | ||
@@ -19,3 +19,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@zag-js/dom-query": "0.0.0-dev-20230225101755", | ||
"@zag-js/dom-query": "0.1.4", | ||
"@zag-js/dom-event": "0.0.1", | ||
@@ -22,0 +22,0 @@ "@zag-js/tabbable": "0.0.1", |
Sorry, the diff of this file is not supported yet
16022
396
+ Added@zag-js/dom-query@0.1.4(transitive)
- Removed@zag-js/dom-query@0.0.0-dev-20230225101755(transitive)
Updated@zag-js/dom-query@0.1.4