@zag-js/interact-outside 1.26.4 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -174,7 +174,8 @@ function trackInteractOutsideImpl(node, options) {
174
174
  function onFocusin(event) {
175
175
  const func = defer ? domQuery.raf : (v) => v();
176
176
  func(() => {
177
- const target = domQuery.getEventTarget(event);
177
+ const composedPath = event?.composedPath?.() ?? [event?.target];
178
+ const target = isInShadowRoot ? composedPath[0] : domQuery.getEventTarget(event);
178
179
  if (!node || !isEventOutside(event, target)) return;
179
180
  if (onFocusOutside || onInteractOutside) {
180
181
  const handler = utils.callAll(onFocusOutside, onInteractOutside);
package/dist/index.mjs CHANGED
@@ -172,7 +172,8 @@ function trackInteractOutsideImpl(node, options) {
172
172
  function onFocusin(event) {
173
173
  const func = defer ? raf : (v) => v();
174
174
  func(() => {
175
- const target = getEventTarget(event);
175
+ const composedPath = event?.composedPath?.() ?? [event?.target];
176
+ const target = isInShadowRoot ? composedPath[0] : getEventTarget(event);
176
177
  if (!node || !isEventOutside(event, target)) return;
177
178
  if (onFocusOutside || onInteractOutside) {
178
179
  const handler = callAll(onFocusOutside, onInteractOutside);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zag-js/interact-outside",
3
- "version": "1.26.4",
3
+ "version": "1.27.0",
4
4
  "description": "Track interactions or focus outside an element",
5
5
  "keywords": [
6
6
  "js",
@@ -16,8 +16,8 @@
16
16
  "dist"
17
17
  ],
18
18
  "dependencies": {
19
- "@zag-js/dom-query": "1.26.4",
20
- "@zag-js/utils": "1.26.4"
19
+ "@zag-js/dom-query": "1.27.0",
20
+ "@zag-js/utils": "1.27.0"
21
21
  },
22
22
  "devDependencies": {
23
23
  "clean-package": "2.2.0"