Skip to content

Conversation

@Nitin-100
Copy link
Contributor

@Nitin-100 Nitin-100 commented Nov 9, 2025

Description

Type of Change

  • New feature (non-breaking change which adds functionality)

Why

The overflow CSS property was not implemented in the Fabric Composition architecture. Paper XAML architecture has supported overflow, but Fabric was missing this functionality entirely. This PR closes the feature gap between the two architectures where views with overflow: hidden do not clip their children in Fabric apps, while they work correctly in Paper apps. This change brings Fabric to parity with Paper by implementing the missing overflow property support.

What

Added overflow clipping support to the Fabric architecture by introducing a dedicated m_contentVisual for mounting children and applying clipping in CompositionViewComponentView.cpp:

  1. Created m_contentVisual - A separate visual layer that is a child of m_visual, used specifically for mounting child components. This allows clipping to be applied independently of the border/background visual.

  2. Updated ensureVisual() - Creates m_contentVisual as a child of m_visual when the visual is initialized.

  3. Updated VisualToMountChildrenInto() - Returns m_contentVisual so all children are mounted into the clippable content visual.

  4. Updated updateLayoutMetrics() - Sizes and offsets m_contentVisual to match the content area (excluding borders), and applies overflow clipping using SetClippingPath with a path geometry that accounts for border radii.

The implementation:

  • Uses BorderPrimitive::resolveAndAlignBorderMetrics() to get accurate border widths
  • Calculates inner border radii by subtracting border widths from outer radii
  • Uses BorderPrimitive::GenerateRoundedRectPathGeometry() to create the clip path
  • Applies clipping via SetClippingPath on m_contentVisual when getClipsContentToBounds() returns true
  • Clears the clip by passing nullptr when overflow is not hidden

This approach properly handles:

  • Rectangular clipping (no border radius)
  • Rounded corner clipping with border radius
  • Border thickness offset for accurate content area clipping

Screenshots

Paper overflow

paper_overflow

Fabric with overflow (before)

ovefflow.mp4

Testing

overflowTest.tsx

Tested with RNTester View overflow examples and custom overflowTest.tsx by navigating to View component and scrolling to the Overflow section. Verified that:

  • Views with overflow: hidden now properly clip overflowing child content
  • Rectangular clipping works correctly (no border radius)
  • Rounded corner clipping works correctly (with border radius)
  • Text overflow clipping works correctly
  • Boxes with overflow: visible correctly allow content to extend beyond their bounds

Ran both playground.sln (Paper) and playground-composition.sln (Fabric) to verify identical behavior between the two architectures.

Changelog

Should this change be included in the release notes: yes

Implemented overflow property support for Fabric architecture. Views with overflow: hidden now properly clip their children to the container bounds, achieving parity with Paper architecture. Added m_contentVisual to properly separate content clipping from border rendering.

@Nitin-100 Nitin-100 requested a review from a team as a code owner November 9, 2025 12:44
@HariniMalothu17
Copy link
Contributor

@Nitin-100
Based on the screenshot u shared there is no visual indication here that the 'overflow' prop is actually implemented
Please check the screenshot section in this link
#14527
image

@Nitin-100 Nitin-100 force-pushed the nitin/parity-fabric/overflow branch from 5603646 to 8527924 Compare November 10, 2025 07:14
@Nitin-100 Nitin-100 force-pushed the nitin/parity-fabric/overflow branch from 8527924 to 85b860f Compare November 10, 2025 07:18
@Nitin-100
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

@acoates-ms
Copy link
Contributor

We already use a clip for rounded corners to clip the background: ComponentView::updateClippingPath.

Really we need to stop doing that for rounded corners, which means fixing our background logic for rounded corners so that that clip is not required. Then we can do this change.

Copy link
Contributor

@acoates-ms acoates-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to work out how to not conflict with the existing clip.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Nov 10, 2025
@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Nov 16, 2025
@anupriya13
Copy link
Contributor

Looks like the prop is not working as expected as per the screenshots attached. Please add E2ETestApp unit tests as well and more examples in playground.

@anupriya13 anupriya13 self-requested a review December 1, 2025 04:22
@Nitin-100
Copy link
Contributor Author

Looks like the prop is not working as expected as per the screenshots attached. Please add E2ETestApp unit tests as well and more examples in playground.

Changes are not added yet, I'm busy with release work.

layoutMetrics.frame.size.height * layoutMetrics.pointScaleFactor});

// Apply overflow clipping
if (m_props && m_props->yogaStyle.overflow() == facebook::yoga::Overflow::Hidden) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about other overflow types?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getClipsContentToBounds check this

winrt::Microsoft::ReactNative::Composition::Experimental::MicrosoftCompositionContextHelper::InnerVisual(
Visual());
if (compVisual) {
compVisual.Clip(nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is as good as doing nothing, right?
If no clip was ever applied, this line is redundant.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review the code.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Dec 1, 2025
@anupriya13
Copy link
Contributor

Looks like the prop is not working as expected as per the screenshots attached. Please add E2ETestApp unit tests as well and more examples in playground.

Changes are not added yet, I'm busy with release work.

Sure, please convert this PR to draft while you work on it.

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs: Author Feedback The issue/PR needs activity from its author (label drives bot activity) label Dec 1, 2025
Nitin-100 and others added 3 commits December 1, 2025 10:53
Hi OSG Instrumentation Team,

I'm working on React Native Windows telemetry. We currently have:

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
EXISTING (working):
- JavaScript CLI telemetry via 1DS SDK
- Instrumentation Key: 49ff6d3ef12f4578a7b75a2573d9dba8-026332b2-2d50-452f-ad0d-50f921c97a9d-7145
- Data flows to: Aria → Kusto
- Kusto cluster: [YOU NEED TO TELL ME THIS]

NEW (want to add):
- Native C++ telemetry via ETW/TraceLogging
- Provider Name: Microsoft.ReactNativeWindows.Telemetry
- Provider GUID: [WILL GENERATE]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

QUESTION:
Can you register the new ETW provider GUID and route it to the SAME
Aria tenant as our existing 1DS instrumentation key?

Goal: Have both JavaScript (1DS) and C++ (ETW) telemetry appear in
the same Kusto database for unified querying.

Is this possible? If yes, what info do you need from me?

Thanks,
Harini Malothu
React Native Windows Team
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants