From a405fa03d08a64ea93d7aab39e359ccef4a5a08d Mon Sep 17 00:00:00 2001 From: vineethkuttan Date: Thu, 25 Sep 2025 21:57:18 +0530 Subject: [PATCH 1/3] Fixing Clipped Property for Modal Component --- .../CompositionDynamicAutomationProvider.cpp | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp index e8da5dc3d53..3ebeb1c217b 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp @@ -561,7 +561,31 @@ 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 + try { + 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 + } + } + } catch (...) { + // 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 3d5f651561ff5d7c35a6384f649a0331e66f6a09 Mon Sep 17 00:00:00 2001 From: vineethkuttan Date: Thu, 25 Sep 2025 22:45:50 +0530 Subject: [PATCH 2/3] Yarn Change --- ...ative-windows-aca77b5b-e0c0-4051-bb1d-70c3e69bec86.json | 7 +++++++ 1 file changed, 7 insertions(+) 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" +} From a78028730484239e1e27e5bb406700f438aa8003 Mon Sep 17 00:00:00 2001 From: vineethkuttan Date: Mon, 29 Sep 2025 09:57:16 +0530 Subject: [PATCH 3/3] Removed try catch. --- .../CompositionDynamicAutomationProvider.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp index 3ebeb1c217b..5e34404bd31 100644 --- a/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp +++ b/vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp @@ -572,14 +572,12 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT // 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 - try { - 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 - } + 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 } - } catch (...) { + } else { // If we can't get window info, fall back to clip state isOffscreen = true; }