From 5d5e4cea99a5b379cf820582ee03612b6623a2f3 Mon Sep 17 00:00:00 2001 From: Vineeth <66076509+vineethkuttan@users.noreply.github.com> Date: Mon, 29 Sep 2025 11:56:25 +0530 Subject: [PATCH 1/2] [Fabric] Fixing Clipped Property for Modal Component (#15176) * Fixing Clipped Property for Modal Component * Yarn Change * Removed try catch. --- ...-aca77b5b-e0c0-4051-bb1d-70c3e69bec86.json | 7 ++++++ .../CompositionDynamicAutomationProvider.cpp | 24 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 change/react-native-windows-aca77b5b-e0c0-4051-bb1d-70c3e69bec86.json diff --git a/change/react-native-windows-aca77b5b-e0c0-4051-bb1d-70c3e69bec86.json b/change/react-native-windows-aca77b5b-e0c0-4051-bb1d-70c3e69bec86.json new file mode 100644 index 00000000000..50bd6d1cbf5 --- /dev/null +++ b/change/react-native-windows-aca77b5b-e0c0-4051-bb1d-70c3e69bec86.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "[Fabric] Fixing Clipped Property for Modal Component", + "packageName": "react-native-windows", + "email": "kvineeth@microsoft.com", + "dependentChangeType": "patch" +} diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp index d67f6d9ca29..713f510e9d4 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp @@ -561,7 +561,29 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT } case UIA_IsOffscreenPropertyId: { pRetVal->vt = VT_BOOL; - pRetVal->boolVal = (compositionView->getClipState() == ClipState::FullyClipped) ? VARIANT_TRUE : VARIANT_FALSE; + + // Special handling for modal content - check if component is in a popup/modal window + bool isOffscreen = true; + auto clipState = compositionView->getClipState(); + + if (clipState != ClipState::FullyClipped) { + isOffscreen = false; + } else { + // Component appears clipped, but check if it's modal content + // Modal content may appear clipped due to lack of parent relationships + // but should still be considered visible if it's in its own window + if (auto hwnd = compositionView->GetHwndForParenting()) { + // Check if this window is visible and not minimized + if (IsWindowVisible(hwnd) && !IsIconic(hwnd)) { + isOffscreen = false; // Window is visible, so content is not offscreen + } + } else { + // If we can't get window info, fall back to clip state + isOffscreen = true; + } + } + + pRetVal->boolVal = isOffscreen ? VARIANT_TRUE : VARIANT_FALSE; break; } case UIA_HelpTextPropertyId: { From dd9af37f364044a3060b51c515d2a3eb42c5a59d Mon Sep 17 00:00:00 2001 From: vineethkuttan Date: Mon, 6 Oct 2025 17:08:10 +0530 Subject: [PATCH 2/2] Review Changes --- .../CompositionDynamicAutomationProvider.cpp | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp index 713f510e9d4..5d66f5f1efe 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp @@ -562,24 +562,13 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT case UIA_IsOffscreenPropertyId: { pRetVal->vt = VT_BOOL; - // Special handling for modal content - check if component is in a popup/modal window - bool isOffscreen = true; - auto clipState = compositionView->getClipState(); - - if (clipState != ClipState::FullyClipped) { - isOffscreen = false; - } else { - // Component appears clipped, but check if it's modal content - // Modal content may appear clipped due to lack of parent relationships - // but should still be considered visible if it's in its own window - if (auto hwnd = compositionView->GetHwndForParenting()) { - // Check if this window is visible and not minimized - if (IsWindowVisible(hwnd) && !IsIconic(hwnd)) { - isOffscreen = false; // Window is visible, so content is not offscreen - } - } else { - // If we can't get window info, fall back to clip state - isOffscreen = true; + // Check if element is offscreen - consider modal content special case + bool isOffscreen = (compositionView->getClipState() == ClipState::FullyClipped); + + // Modal content may appear clipped but is visible in its own window + if (isOffscreen) { + if (const auto hwnd = compositionView->GetHwndForParenting()) { + isOffscreen = !(IsWindowVisible(hwnd) && !IsIconic(hwnd)); } }