Repository navigation
Conversation
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 36277Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 36277" |
656de61 to
4d507b5
Compare
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 2 findings
See inline comments for details.
kubaflo
left a comment
There was a problem hiding this comment.
Could you please check the ai's suggestions and verify failing tests?
There was a problem hiding this comment.
Pull request overview
Fixes RTL flow-direction handling for FormattedText on iOS/AppKit-backed targets by pushing the resolved flow direction into the attributed-string paragraph style (writing direction + Start/End mirroring), so formatted labels behave consistently with plain-text labels.
Changes:
- Resolve and pass the label’s effective flow direction (inherited RTL included) into the iOS formatted-text conversion pipeline.
- Set
NSMutableParagraphStyle.BaseWritingDirectionand mirrorTextAlignment.Start/Endwhen RTL while preservingJustify. - Add UI test coverage via a new HostApp issue page + screenshot-based UITest for Issue #31480.
Reviewed changes
Copilot reviewed 3 out of 5 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/Controls/src/Core/Platform/iOS/Extensions/FormattedStringExtensions.cs | Resolve effective flow direction; apply paragraph writing direction and RTL-aware Start/End alignment for formatted spans. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue31480.cs | Adds repro page for formatted label RTL/LTR layout. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31480.cs | Adds screenshot UITest validating RTL formatted label rendering. |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
cd474ce to
0312161
Compare
9942f14 to
a6e2d41
Compare
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Description of Change Fixes screenshot publication for the merged `/review tests` visual-comparison workflow. New visual assets are now published from an orphan, asset-only `review-tests-assets-v2` branch. The publisher initializes that branch with a root commit containing only a marker blob. On every publication attempt it permits top-level blobs and `pr-<number>` directories, while rejecting trees at any other path, submodule gitlinks, malformed entries, and truncated root-tree responses. The local runner also recognizes report markers only when they occupy a standalone line, preventing a marker quoted in agent prose from leaking a junk preamble or duplicate marker into the posted comment. The legacy `review-tests-assets` branch remains untouched so all existing `raw.githubusercontent.com` links pinned to its historical commit SHAs remain reachable. ### Root Cause Production validation on PRs #36628 and #36404 showed that the merged workflow activated correctly, gathered evidence, invoked the agent, and posted the ordinary analysis comments: - [run 30131857502](https://github.com/dotnet/maui/actions/runs/30131857502) / [comment on #36628](#36628 (comment)) - [run 30131857838](https://github.com/dotnet/maui/actions/runs/30131857838) / [comment on #36404](#36404 (comment)) Both comments contained zero screenshot panels. Their trusted pre-activation jobs had `contents: write`, prepared visual evidence, and successfully created Git blobs, trees, and commits, but failed when advancing the asset ref: ```text PATCH repos/dotnet/maui/git/refs/heads/review-tests-assets HTTP 403: Resource not accessible by integration ``` `review-tests-assets` had originally been initialized by pointing it at `main`, so every generated asset commit inherited the entire repository tree, including `.github/workflows`. Updating a ref whose resulting tree contains workflow files requires GitHub's separate Workflows write permission, which cannot be granted to `GITHUB_TOKEN`. ### Fix - Switch new publication to `review-tests-assets-v2`. - Initialize a missing asset branch as an orphan root containing only `.review-tests-assets`. - Never copy the default branch tree into an asset branch. - Validate existing and concurrently-created branch tips before use. - Fail closed when the root tree is truncated or contains any top-level entry that is neither a blob nor a `pr-<positive-number>` directory. Plain blobs cannot carry `.github/workflows`, so optional files such as a README remain safe. - Preserve the existing fast-forward retry behavior for concurrent publishers. - Keep the agent job read-only and avoid introducing a broader PAT or GitHub App credential. - Extract only standalone report marker or heading lines from local Copilot output, ignoring quoted markers in explanatory prose. ### Validation - 171 focused Pester tests pass across gathering, publication, visual merging, and the local runner, including all 28 publisher tests and seven new report-extraction regression cases. - PowerShell parsing passes. - [Fork Actions smoke run 30153639425](https://github.com/kubaflo/maui/actions/runs/30153639425) passed using only the job-scoped `GITHUB_TOKEN` with `contents: write`. It created a zero-parent, marker-only root; advanced `review-tests-assets-v2` to an asset commit; verified the root contains only the marker and `pr-36785`; and downloaded the [immutable published PNG](https://raw.githubusercontent.com/kubaflo/maui/0d9677267ed6521b7530bbd3d4bae929767e4dbb/pr-36785/smoke/run-30153639425-actual.png). - [Real-evidence fork run 30154060821](https://github.com/kubaflo/maui/actions/runs/30154060821) replayed the last available `maui-pr-uitests` build for PR #33007 through the unchanged publisher and panel merger. It gathered 98 real comparisons, published the bounded 24 comparisons as 72 baseline/actual/diff PNGs at asset commit [`5d114f9`](kubaflo@5d114f9), rendered 15 screenshot panels within the 45-URL comment limit, and verified every embedded immutable PNG URL. - A full local `/review tests` run on PR #33007 gathered all three available MAUI builds, ran the `claude-opus-4.8` analysis, published 24 comparisons to the upstream orphan asset branch, merged 13 bounded panels, and [posted the complete report](#33007 (comment)). Its `Not ready` verdict matches the deterministic ceiling, and all 39 embedded PNG URLs were verified. - A full local run on PR #35892 published 22 comparisons at asset commit [`f50f5a1`](f50f5a1), merged 12 bounded panels, and [posted the complete report](#35892 (comment)). Its `Not ready` verdict matches the deterministic ceiling, and all 36 embedded immutable PNG URLs return HTTP 200. - A full local run from publisher commit `aad33ce` on PR #36507 published 3 comparisons at asset commit [`3cb2045`](3cb2045), merged 3 bounded panels, and [updated the complete report](#36507 (comment)). Its `Not ready` verdict matches the deterministic ceiling, all 9 embedded immutable PNG URLs return HTTP 200, and replaying the exact quoted-marker output through parser commit `30cfb3d` produces one local marker with no junk preamble. - Full local runs on PRs [#36277](#36277 (comment)) and [#36404](#36404 (comment)) found no publishable visual snapshots and correctly kept the ordinary analysis unchanged. Their final verdicts match their deterministic ceilings, covering the no-visual path. - After these publications, `review-tests-assets-v2` still contains only `.review-tests-assets` and top-level `pr-<number>` directories; its tip `3cb2045` fast-forwards from `f67ed0e`. - `gh aw` v0.82.14 compiles `copilot-review-tests` with 0 errors and 0 warnings; the generated lock and actions lock remain unchanged. - A focused read-only review found no significant correctness, security, data-loss, race, or compatibility issues. ### Issues Fixed Follow-up to #36666. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: kubaflo <kubaflo@users.noreply.github.com> Copilot-Session: a280b482-e102-4ca0-9ff9-1cfe1946e21f Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d Copilot-Session: 56ae58e8-a78b-4f24-9920-bc096dfb01fa
kubaflo
left a comment
There was a problem hiding this comment.
Could you please resolve conflicts?
…wdirection-rtl-formattedtext # Conflicts: # src/Controls/src/Core/Handlers/Items2/iOS/ItemsViewController2.cs # src/Controls/src/Core/Handlers/Shell/ShellItemHandler.Windows.cs # src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt # src/Controls/src/SourceGen/AnalyzerReleases.Unshipped.md # src/Controls/src/SourceGen/CSharpExpressionHelpers.cs # src/Controls/tests/SourceGen.UnitTests/CSharpExpressionDiagnosticsTests.cs # src/Controls/tests/TestCases.HostApp/FeatureMatrix/SafeArea/SafeAreaFeaturePage.xaml # src/Controls/tests/TestCases.HostApp/FeatureMatrix/SafeArea/SafeAreaFeaturePage.xaml.cs # src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/Issue32984PickerShouldResize.png # src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/PageShouldNotMoveOutsideViewportWhenEntryFocusedOnPageLoad.png # src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/PickerNewKeyboardIsAboveKeyboard_Entry7.png # src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/PickerNewKeyboardIsAboveKeyboard_Picker6.png # src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/PickerShouldShowSelectedItemHighlight.png # src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/Picker_TapPicker_TakeScreenshot.png # src/Controls/tests/TestCases.iOS.Tests/snapshots/ios-26/ShouldAppearItemsWhenTappingOnPickerUsingPushModalAsync.png # src/Core/src/Platform/iOS/MauiDoneAccessoryView.cs # src/Core/tests/DeviceTests/Platform/iOS/MauiDoneAccessoryViewTests.iOS.cs # src/TestUtils/src/Microsoft.Maui.IntegrationTests/SimpleTemplateTest.cs
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
Tests Failure Analysis
Test Failure Review: Not ready - click to expandOverall verdict: Not ready. Two distinct failures are genuine regressions vs the base branch (
Coverage: 96 checks · 54 passing · 42 failing · 0 pending · 0 inaccessible · 1 unmapped · 59 unexplained build legs · 0 unaccounted failing checks · 1 aborted failing check · 0 canceled-build checks · 3 device-test unverified · 192 unattributed · 2 regressed-vs-base. Deterministic ceiling: Not ready — 2 legs regressed vs base plus unexplained legs, an aborted check, unverified device tests, and 192 unattributed failures. Builds (this PR): maui-pr 1532734, maui-pr-devicetests 1532754, maui-pr-uitests 1532753. Base sampling ( Recommended actionInvestigate the two Visual failure comparisonsFull-resolution CI baseline, actual, and diff images are embedded below. They supplement the failure classification and do not change the deterministic verdict ceiling.
|
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_CharacterSpacing - windows - Needs human investigation - visual comparison
CI reported 1.85% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_CancelButtonColor - windows - Needs human investigation - visual comparison
CI reported 1.79% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_TextColor - windows - Needs human investigation - visual comparison
CI reported 1.67% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_TextTransformLowercase - windows - Needs human investigation - visual comparison
CI reported 1.79% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_SearchBoxVisibilityExpanded - windows - Needs human investigation - visual comparison
CI reported 1.46% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_SearchBoxVisibilityCollapsible - windows - Needs human investigation - visual comparison
CI reported 1.48% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_HorizontalTextAlignmentStart - windows - Needs human investigation - visual comparison
CI reported 1.36% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_HorizontalTextAlignmentEnd - windows - Needs human investigation - visual comparison
CI reported 1.20% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
VerifyShellSearch_HorizontalTextAlignmentCenter - windows - Needs human investigation - visual comparison
CI reported 1.18% difference in build 1532753.
Relationship to PR: Needs human investigation - No decisive exact test-and-platform baseline attribution was available.
| CI baseline | Fresh PR actual | CI diff |
|---|---|---|
![]() |
![]() |
![]() |
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------
<!-- Please let the below note in for people that find this PR --> > [!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](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from this PR and let us know in a comment if this change resolves your issue. Thank you! ### Issue Details: Right-to-left layout is not applied to FormattedText. ### Root Cause For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly. For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR. ### Description of Change The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts. Validated the behaviour in the following platforms - [ ] Android - [ ] Windows - [x] iOS - [x] Mac ### Issues Fixed: Fixes #31480 ### Screenshots | Before | After | |---------|--------| | <img height=600 width=300 src="https://github.com/user-attachments/assets/fb52d707-77ca-48f1-87cc-4deab9849ea9"> | <img height=600 width=300 src="https://github.com/user-attachments/assets/cd8767a4-fedf-481f-899e-dd96ce2e9005"> | ---------

































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!
Issue Details:
Right-to-left layout is not applied to FormattedText.
Root Cause
For plain text, MAUI sets the alignment directly on the native UILabel, and iOS automatically respects the label's SemanticContentAttribute, so RTL rendering works correctly.
For FormattedText, iOS renders using an NSAttributedString, where text layout is controlled by the embedded NSParagraphStyleinstead of the parent UILabel. The implementation only set paragraph alignment and did not set BaseWritingDirection, and Start/End alignment was not mirrored for RTL. Additionally, label.FlowDirection was used instead of the effective flow direction, so inherited RTL (MatchParent) was not honored. As a result, formatted text always rendered as LTR.
Description of Change
The fix resolves the effective flow direction using EffectiveFlowDirection, ensuring inherited RTL is respected. It also sets NSParagraphStyle.BaseWritingDirection for each span and mirrors Start/End alignment based on the resolved flow direction. This makes FormattedText render consistently with plain text in both LTR and RTL layouts.
Validated the behaviour in the following platforms
Issues Fixed:
Fixes #31480
Screenshots