@abgov/react-components 7.2.0-dev.1 → 7.2.0-dev.2

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/index.js CHANGED
@@ -2678,14 +2678,19 @@ function GoabDrawer({
2678
2678
  }) {
2679
2679
  const el = react.useRef(null);
2680
2680
  react.useEffect(() => {
2681
- var _a;
2682
2681
  if (!(el == null ? void 0 : el.current) || !onClose) {
2683
2682
  return;
2684
2683
  }
2685
- (_a = el.current) == null ? void 0 : _a.addEventListener("_close", onClose);
2684
+ const current = el.current;
2685
+ const listener = (e) => {
2686
+ if (e.target !== current) {
2687
+ return;
2688
+ }
2689
+ onClose();
2690
+ };
2691
+ current.addEventListener("_close", listener);
2686
2692
  return () => {
2687
- var _a2;
2688
- (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_close", onClose);
2693
+ current.removeEventListener("_close", listener);
2689
2694
  };
2690
2695
  }, [el, onClose]);
2691
2696
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -3580,7 +3585,10 @@ function GoabModal({
3580
3585
  return;
3581
3586
  }
3582
3587
  const current = el.current;
3583
- const listener = () => {
3588
+ const listener = (e) => {
3589
+ if (e.target !== current) {
3590
+ return;
3591
+ }
3584
3592
  onClose == null ? void 0 : onClose();
3585
3593
  };
3586
3594
  current.addEventListener("_close", listener);
@@ -3731,14 +3739,19 @@ function GoabPushDrawer({
3731
3739
  }) {
3732
3740
  const el = react.useRef(null);
3733
3741
  react.useEffect(() => {
3734
- var _a;
3735
3742
  if (!(el == null ? void 0 : el.current) || !onClose) {
3736
3743
  return;
3737
3744
  }
3738
- (_a = el.current) == null ? void 0 : _a.addEventListener("_close", onClose);
3745
+ const current = el.current;
3746
+ const listener = (e) => {
3747
+ if (e.target !== current) {
3748
+ return;
3749
+ }
3750
+ onClose();
3751
+ };
3752
+ current.addEventListener("_close", listener);
3739
3753
  return () => {
3740
- var _a2;
3741
- (_a2 = el.current) == null ? void 0 : _a2.removeEventListener("_close", onClose);
3754
+ current.removeEventListener("_close", listener);
3742
3755
  };
3743
3756
  }, [el, onClose]);
3744
3757
  return /* @__PURE__ */ jsxRuntime.jsxs(