@canvas-components/react-components 0.3.9 → 0.3.11

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.cjs CHANGED
@@ -495,9 +495,13 @@ function ReactPopup(props) {
495
495
  )
496
496
  }
497
497
  ),
498
- document.body
498
+ resolvePopupContainer(anchorRef?.current)
499
499
  );
500
500
  }
501
+ function resolvePopupContainer(anchor) {
502
+ const fullscreenElement = document.fullscreenElement;
503
+ return fullscreenElement instanceof HTMLElement && (!anchor || fullscreenElement.contains(anchor)) ? fullscreenElement : document.body;
504
+ }
501
505
  function resolvePopupPosition(params) {
502
506
  const {
503
507
  anchor,
@@ -5430,6 +5434,7 @@ function ReactModal(props) {
5430
5434
  const [innerFullscreen, setInnerFullscreen] = React.useState(defaultFullscreen);
5431
5435
  const [innerConfirmLoading, setInnerConfirmLoading] = React.useState(false);
5432
5436
  const [dragOffset, setDragOffset] = React.useState({ x: 0, y: 0 });
5437
+ const [, setFullscreenRevision] = React.useState(0);
5433
5438
  const panelRef = React.useRef(null);
5434
5439
  const dragRef = React.useRef(null);
5435
5440
  const restoreFocusRef = React.useRef(null);
@@ -5442,6 +5447,16 @@ function ReactModal(props) {
5442
5447
  const mergedFullscreen = controlledFullscreen ? Boolean(fullscreen) : innerFullscreen;
5443
5448
  const mergedConfirmLoading = confirmLoading ?? innerConfirmLoading;
5444
5449
  const hasTitle = title !== null && title !== void 0 && title !== false;
5450
+ React.useEffect(() => {
5451
+ if (!transition.rendered || typeof document === "undefined") return;
5452
+ const handleFullscreenChange = () => {
5453
+ setFullscreenRevision((revision) => revision + 1);
5454
+ };
5455
+ document.addEventListener("fullscreenchange", handleFullscreenChange);
5456
+ return () => {
5457
+ document.removeEventListener("fullscreenchange", handleFullscreenChange);
5458
+ };
5459
+ }, [transition.rendered]);
5445
5460
  React.useEffect(() => {
5446
5461
  if (previousOpenRef.current === open) {
5447
5462
  return;
@@ -5752,7 +5767,9 @@ function resolveContainer(getContainer) {
5752
5767
  if (typeof document === "undefined") {
5753
5768
  return null;
5754
5769
  }
5755
- return typeof getContainer === "function" ? getContainer() : getContainer ?? document.body;
5770
+ if (typeof getContainer === "function") return getContainer();
5771
+ if (getContainer) return getContainer;
5772
+ return document.fullscreenElement instanceof HTMLElement ? document.fullscreenElement : document.body;
5756
5773
  }
5757
5774
  function trapFocus(event, panel) {
5758
5775
  if (!panel) {