diff --git a/src/modules/geoportal/v2/cf-order-modal.tsx b/src/modules/geoportal/v2/cf-order-modal.tsx index 7ae3dc6..6b86f04 100644 --- a/src/modules/geoportal/v2/cf-order-modal.tsx +++ b/src/modules/geoportal/v2/cf-order-modal.tsx @@ -17,6 +17,7 @@ // error → any failure with retry option import { useCallback, useEffect, useRef, useState } from "react"; +import { createPortal } from "react-dom"; import { X, Loader2, Check, AlertCircle, FileText, Coins, Plug, ArrowRight, Download, @@ -276,12 +277,18 @@ export function CfOrderModal({ ); if (!open) return null; + // Render via portal so the modal escapes the panel's containing + // block — the parent V2 panel uses backdrop-blur-md which (per CSS + // spec) creates a containing block for `fixed` descendants. Without + // the portal the modal anchors to the panel's top-right corner and + // gets clipped above the viewport. + if (typeof document === "undefined") return null; - return ( + return createPortal(
{ // dismiss on backdrop click only when not mid-flight if ( @@ -602,7 +609,8 @@ export function CfOrderModal({ )}
- + , + document.body, ); } diff --git a/src/modules/geoportal/v2/feature-info-panel.tsx b/src/modules/geoportal/v2/feature-info-panel.tsx index 702317a..6712284 100644 --- a/src/modules/geoportal/v2/feature-info-panel.tsx +++ b/src/modules/geoportal/v2/feature-info-panel.tsx @@ -406,6 +406,13 @@ export function FeatureInfoPanel({ feature, onClose, onSelectFeature, basic = fa const [condoLoading, setCondoLoading] = useState(false); const [cfModalOpen, setCfModalOpen] = useState(false); + // Close the CF modal whenever the user switches to a different + // parcel — keeps the modal scoped to a single decision instead of + // silently re-targeting mid-flight. + useEffect(() => { + setCfModalOpen(false); + }, [feature.cadastralRef, feature.siruta, feature.layerId]); + const authRetriedRef = useRef( typeof window !== "undefined" && sessionStorage.getItem(AUTH_RETRY_KEY) === "1",