Skip to content

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Nov 3, 2025

Note

Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!

Description of Change

Explicitly sets the semantic content attribute on the native UICollectionView to ensure compositional layouts mirror columns correctly in right-to-left (RTL) scenarios. This addresses an issue where the platform view's semantic attribute does not propagate to native children not backed by IView.

Before After
Screen.Recording.2025-11-04.at.00.40.34.mov
Screen.Recording.2025-11-04.at.00.37.54.mov

Issues Fixed

Fixes #32359

Explicitly sets the semantic content attribute on the native UICollectionView to ensure compositional layouts mirror columns correctly in right-to-left (RTL) scenarios. This addresses an issue where the platform view's semantic attribute does not propagate to native children not backed by IView.
Copilot AI review requested due to automatic review settings November 3, 2025 23:39
@kubaflo kubaflo self-assigned this Nov 3, 2025
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 3, 2025
@dotnet-policy-service
Copy link
Contributor

Hey there @@kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@kubaflo
Copy link
Contributor Author

kubaflo commented Nov 3, 2025

@copilot please write a UI test for this PR based on this issue #32359

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an issue where iOS UICollectionView compositional layouts don't properly mirror columns in right-to-left (RTL) flow directions. The fix explicitly sets the SemanticContentAttribute on the native UICollectionView to ensure RTL layout behavior is correctly applied.

  • Adds explicit semantic content attribute handling for the UICollectionView based on FlowDirection
  • Maps FlowDirection enum values to appropriate UISemanticContentAttribute values
  • Only updates the SemanticContentAttribute when it differs from the desired value

Comment on lines +328 to +331
case FlowDirection.MatchParent:
// Let it inherit from the parent view we just updated
desiredAttr = UISemanticContentAttribute.Unspecified;
break;
Copy link

Copilot AI Nov 3, 2025

Choose a reason for hiding this comment

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

The switch statement can be simplified by initializing desiredAttr within the switch expression or handling the MatchParent case implicitly. Since desiredAttr is already initialized to Unspecified (line 319), the MatchParent case at line 328-331 is redundant and can be removed. Alternatively, use a switch expression to make the intent clearer.

Suggested change
case FlowDirection.MatchParent:
// Let it inherit from the parent view we just updated
desiredAttr = UISemanticContentAttribute.Unspecified;
break;

Copilot uses AI. Check for mistakes.
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

Could include an UITest to check that after switching to RTL: first column is right‑anchored?

}

if (CollectionView.SemanticContentAttribute != desiredAttr)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Compositional and flow layouts may not re-query attributes immediately, requires to force a layout pass?

@Ahamed-Ali Ahamed-Ali added area-controls-collectionview CollectionView, CarouselView, IndicatorView s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed i/regression This issue described a confirmed regression on a currently supported version collectionview-cv1 regressed-in-9.0.120 and removed area-controls-collectionview CollectionView, CarouselView, IndicatorView s/verified Verified / Reproducible Issue ready for Engineering Triage s/triaged Issue has been reviewed collectionview-cv1 regressed-in-9.0.120 i/regression This issue described a confirmed regression on a currently supported version labels Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] FlowDirection="RightToLeft" issue in CollectionView version 9.0.120

3 participants