Skip to content

Commit 5d5e4ce

Browse files
committed
[Fabric] Fixing Clipped Property for Modal Component (#15176)
* Fixing Clipped Property for Modal Component * Yarn Change * Removed try catch.
1 parent 853633a commit 5d5e4ce

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "[Fabric] Fixing Clipped Property for Modal Component",
4+
"packageName": "react-native-windows",
5+
"email": "kvineeth@microsoft.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/Microsoft.ReactNative/Fabric/Composition/CompositionDynamicAutomationProvider.cpp

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,29 @@ HRESULT __stdcall CompositionDynamicAutomationProvider::GetPropertyValue(PROPERT
561561
}
562562
case UIA_IsOffscreenPropertyId: {
563563
pRetVal->vt = VT_BOOL;
564-
pRetVal->boolVal = (compositionView->getClipState() == ClipState::FullyClipped) ? VARIANT_TRUE : VARIANT_FALSE;
564+
565+
// Special handling for modal content - check if component is in a popup/modal window
566+
bool isOffscreen = true;
567+
auto clipState = compositionView->getClipState();
568+
569+
if (clipState != ClipState::FullyClipped) {
570+
isOffscreen = false;
571+
} else {
572+
// Component appears clipped, but check if it's modal content
573+
// Modal content may appear clipped due to lack of parent relationships
574+
// but should still be considered visible if it's in its own window
575+
if (auto hwnd = compositionView->GetHwndForParenting()) {
576+
// Check if this window is visible and not minimized
577+
if (IsWindowVisible(hwnd) && !IsIconic(hwnd)) {
578+
isOffscreen = false; // Window is visible, so content is not offscreen
579+
}
580+
} else {
581+
// If we can't get window info, fall back to clip state
582+
isOffscreen = true;
583+
}
584+
}
585+
586+
pRetVal->boolVal = isOffscreen ? VARIANT_TRUE : VARIANT_FALSE;
565587
break;
566588
}
567589
case UIA_HelpTextPropertyId: {

0 commit comments

Comments
 (0)