@canvas-components/react-components 0.3.10 → 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
@@ -5434,6 +5434,7 @@ function ReactModal(props) {
5434
5434
  const [innerFullscreen, setInnerFullscreen] = React.useState(defaultFullscreen);
5435
5435
  const [innerConfirmLoading, setInnerConfirmLoading] = React.useState(false);
5436
5436
  const [dragOffset, setDragOffset] = React.useState({ x: 0, y: 0 });
5437
+ const [, setFullscreenRevision] = React.useState(0);
5437
5438
  const panelRef = React.useRef(null);
5438
5439
  const dragRef = React.useRef(null);
5439
5440
  const restoreFocusRef = React.useRef(null);
@@ -5446,6 +5447,16 @@ function ReactModal(props) {
5446
5447
  const mergedFullscreen = controlledFullscreen ? Boolean(fullscreen) : innerFullscreen;
5447
5448
  const mergedConfirmLoading = confirmLoading ?? innerConfirmLoading;
5448
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]);
5449
5460
  React.useEffect(() => {
5450
5461
  if (previousOpenRef.current === open) {
5451
5462
  return;
@@ -5756,7 +5767,9 @@ function resolveContainer(getContainer) {
5756
5767
  if (typeof document === "undefined") {
5757
5768
  return null;
5758
5769
  }
5759
- 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;
5760
5773
  }
5761
5774
  function trapFocus(event, panel) {
5762
5775
  if (!panel) {