@qyu/reactcmp-dropdown 2.1.0 → 2.1.1

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.
@@ -1372,9 +1372,9 @@ const refs_unpack = function* (src) {
1372
1372
  }
1373
1373
  }
1374
1374
  };
1375
- const element_outside = function (element, shards) {
1375
+ const element_outside = function (path, shards) {
1376
1376
  for (const ref of shards) {
1377
- if (ref === element || ref.contains(element)) {
1377
+ if (path.includes(ref)) {
1378
1378
  return false;
1379
1379
  }
1380
1380
  }
@@ -1393,12 +1393,13 @@ const useCloseEvtRoot = function (params) {
1393
1393
  if (nconfig_blur) {
1394
1394
  document.addEventListener("focusin", ev => {
1395
1395
  if (ev.target instanceof Element) {
1396
+ const path = ev.composedPath();
1396
1397
  if (ev.target.hasAttribute("data-focusguard")) {
1397
- if (element_outside(ev.target, refs_unpack(ctxstate_refs.register.it_down))) {
1398
+ if (element_outside(path, refs_unpack(ctxstate_refs.register.it_down))) {
1398
1399
  ctxstate_open.open_set(false);
1399
1400
  }
1400
1401
  }
1401
- else if (element_outside(ev.target, refs_unpack(ctxstate_refs.register.it_context))) {
1402
+ else if (element_outside(path, refs_unpack(ctxstate_refs.register.it_context))) {
1402
1403
  ctxstate_open.open_set(false);
1403
1404
  }
1404
1405
  }
@@ -1406,11 +1407,10 @@ const useCloseEvtRoot = function (params) {
1406
1407
  }
1407
1408
  if (nconfig_click) {
1408
1409
  document.addEventListener("click", ev => {
1410
+ const path = ev.composedPath();
1409
1411
  const shards = refs_unpack(ctxstate_refs.register.it_context);
1410
- if (ev.target instanceof Element) {
1411
- if (element_outside(ev.target, shards)) {
1412
- ctxstate_open.open_set(false);
1413
- }
1412
+ if (element_outside(path, shards)) {
1413
+ ctxstate_open.open_set(false);
1414
1414
  }
1415
1415
  }, { signal: controller.signal });
1416
1416
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@qyu/reactcmp-dropdown",
3
3
  "type": "module",
4
- "version": "2.1.0",
4
+ "version": "2.1.1",
5
5
  "main": "./build/bundle/entry/index.js",
6
6
  "description": "React Components for Dropdown Positioning",
7
7
  "keywords": [