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 e8da5dc3d53..5e34404bd31 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: {