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

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