-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixed Editor HorizontalTextAlignment does not update at run time #25129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kubaflo
merged 28 commits into
dotnet:inflight/current
from
NirmalKumarYuvaraj:fix-10987
Mar 26, 2026
Merged
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
381bb24
Fixed - 10987 - Editor HorizontalTextAlignment Does not Works.
NirmalKumarYuvaraj 19dbacd
Added test case images
NirmalKumarYuvaraj 2b994a8
Modified code changes
NirmalKumarYuvaraj 3a07211
Replaced test case images
NirmalKumarYuvaraj 59af2a7
Modified test images
NirmalKumarYuvaraj 93a95ac
Added Windows test case image
NirmalKumarYuvaraj c60834b
Modified code changes
NirmalKumarYuvaraj 3920326
Added android test images
NirmalKumarYuvaraj dd111e7
Fixed - 10987 - Editor HorizontalTextAlignment Does not Works.
NirmalKumarYuvaraj 5f8c204
Added test case images
NirmalKumarYuvaraj 6820218
Modified code changes
NirmalKumarYuvaraj f4d6c4f
Replaced test case images
NirmalKumarYuvaraj ebbebf6
Modified test images
NirmalKumarYuvaraj b6c8481
Added RTL Editor testcases and images
NirmalKumarYuvaraj 5462662
Modified test script file and added images
NirmalKumarYuvaraj dd53e39
Added pending test images
NirmalKumarYuvaraj e939062
Modified code changes
NirmalKumarYuvaraj 067f16a
Updated code changes
NirmalKumarYuvaraj a4eddf2
Added Mac snapshots
NirmalKumarYuvaraj 6f733ff
Added mac and android snapshots
NirmalKumarYuvaraj c67d7b1
Updated code changes
NirmalKumarYuvaraj 43eb493
Modified test cases
NirmalKumarYuvaraj 86307f3
modified test case
NirmalKumarYuvaraj c3cdcc6
Fixed test case failures
NirmalKumarYuvaraj ee203fd
updated unshipped files
NirmalKumarYuvaraj 5f15c94
Added failure snaps
NirmalKumarYuvaraj ac297ed
addressed failures
NirmalKumarYuvaraj a3f2f52
replaced android images
NirmalKumarYuvaraj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+33.5 KB
...ndroid.Tests/snapshots/android/EditorPlaceholderRuntimeTextAlignmentChanged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+29.8 KB
...TestCases.Android.Tests/snapshots/android/EditorRuntimeTextAlignmentChanged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 10987, "Editor HorizontalTextAlignment Does not Works.", PlatformAffected.All)] | ||
| public class Issue10987 : TestContentPage | ||
| { | ||
| Editor lTReditor, rTLeditor; | ||
| Button updateAlignmentButton, resetAlignmentButton; | ||
| protected override void Init() | ||
| { | ||
|
|
||
| updateAlignmentButton = CreateButton("UpdateAlignmentButton", "Update alignment"); | ||
| resetAlignmentButton = CreateButton("ResetAlignmentButton", "Reset alignment"); | ||
|
|
||
| updateAlignmentButton.Clicked += OnUpdateAlignmentButtonClicked; | ||
| resetAlignmentButton.Clicked += OnResetAlignmentButtonClicked; | ||
|
|
||
| lTReditor = CreateEditor("LTREditor", "placeholder text", FlowDirection.LeftToRight); | ||
| rTLeditor = CreateEditor("RTLEditor", "placeholder text", FlowDirection.RightToLeft); | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Spacing = 25, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| Children = | ||
| { | ||
| updateAlignmentButton, | ||
| resetAlignmentButton, | ||
| lTReditor, | ||
| rTLeditor | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| Button CreateButton(string automationId, string text) | ||
| { | ||
| Button button = new Button(); | ||
| button.AutomationId = automationId; | ||
| button.Text = text; | ||
| return button; | ||
| } | ||
|
|
||
| Editor CreateEditor(string automationId, string placeholderText, FlowDirection flowDirection) | ||
| { | ||
| Editor editor = new Editor(); | ||
| editor.AutomationId = automationId; | ||
| editor.BackgroundColor = Colors.LightBlue; | ||
| editor.Placeholder = placeholderText; | ||
| editor.HeightRequest = 250; | ||
| editor.WidthRequest = 220; | ||
| editor.FlowDirection = flowDirection; | ||
| return editor; | ||
| } | ||
|
|
||
| private void OnResetAlignmentButtonClicked(object sender, EventArgs e) | ||
| { | ||
| lTReditor.VerticalTextAlignment = TextAlignment.Start; | ||
| lTReditor.HorizontalTextAlignment = TextAlignment.Start; | ||
| lTReditor.Unfocus(); | ||
|
|
||
| rTLeditor.VerticalTextAlignment = TextAlignment.Start; | ||
| rTLeditor.HorizontalTextAlignment = TextAlignment.Start; | ||
| rTLeditor.Unfocus(); | ||
| } | ||
|
|
||
| private void OnUpdateAlignmentButtonClicked(object sender, EventArgs e) | ||
| { | ||
| lTReditor.VerticalTextAlignment = TextAlignment.End; | ||
| lTReditor.HorizontalTextAlignment = TextAlignment.End; | ||
|
|
||
| rTLeditor.VerticalTextAlignment = TextAlignment.End; | ||
| rTLeditor.HorizontalTextAlignment = TextAlignment.End; | ||
| } | ||
| } |
Binary file added
BIN
+13.3 KB
...tCases.Mac.Tests/snapshots/mac/EditorPlaceholderRuntimeTextAlignmentChanged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+12.7 KB
...s/tests/TestCases.Mac.Tests/snapshots/mac/EditorRuntimeTextAlignmentChanged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7 Bytes
(100%)
...stCases.Mac.Tests/snapshots/mac/VerifyEditorPlaceholderWhenFlowDirectionSet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+17 Bytes
(100%)
...ases.Mac.Tests/snapshots/mac/VerifyEditorPlaceholderWithHorizontalAlignment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions
39
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue10987.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue10987 : _IssuesUITest | ||
| { | ||
| const string LTREditor = "LTREditor"; | ||
| const string RTLEditor = "RTLEditor"; | ||
| public Issue10987(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "Editor HorizontalTextAlignment Does not Works."; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Editor)] | ||
| public void EditorPlaceholderRuntimeTextAlignmentChanged() | ||
| { | ||
| App.WaitForElement(RTLEditor); | ||
| App.Tap("UpdateAlignmentButton"); | ||
| VerifyScreenshot(); | ||
| } | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Editor)] | ||
| public void EditorRuntimeTextAlignmentChanged() | ||
| { | ||
| //To make sure editor is focused in mac platform | ||
| App.Tap(LTREditor); | ||
| App.EnterText(LTREditor, "Editor Text"); | ||
| App.WaitForElement(RTLEditor); | ||
| App.EnterText(RTLEditor, "RTL Editor"); | ||
| #if IOS | ||
|
||
| var app = App as AppiumApp; | ||
| KeyboardScrolling.HideKeyboard(app!, app!.Driver, true); | ||
| #endif | ||
| App.Tap("ResetAlignmentButton"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
Binary file added
BIN
+9.85 KB
....WinUI.Tests/snapshots/windows/EditorPlaceholderRuntimeTextAlignmentChanged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.01 KB
...s/TestCases.WinUI.Tests/snapshots/windows/EditorRuntimeTextAlignmentChanged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+38 KB
...tCases.iOS.Tests/snapshots/ios/EditorPlaceholderRuntimeTextAlignmentChanged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36 KB
...s/tests/TestCases.iOS.Tests/snapshots/ios/EditorRuntimeTextAlignmentChanged.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+7 Bytes
(100%)
...stCases.iOS.Tests/snapshots/ios/VerifyEditorPlaceholderWhenFlowDirectionSet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+9 Bytes
(100%)
...ases.iOS.Tests/snapshots/ios/VerifyEditorPlaceholderWithHorizontalAlignment.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| #nullable enable | ||
| override Microsoft.Maui.Platform.MauiView.DidUpdateFocus(UIKit.UIFocusUpdateContext! context, UIKit.UIFocusAnimationCoordinator! coordinator) -> void | ||
| override Microsoft.Maui.Platform.MauiTextView.TextAlignment.get -> UIKit.UITextAlignment | ||
| override Microsoft.Maui.Platform.MauiTextView.TextAlignment.set -> void |
2 changes: 2 additions & 0 deletions
2
src/Core/src/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,4 @@ | ||
| #nullable enable | ||
| override Microsoft.Maui.Platform.MauiView.DidUpdateFocus(UIKit.UIFocusUpdateContext! context, UIKit.UIFocusAnimationCoordinator! coordinator) -> void | ||
| override Microsoft.Maui.Platform.MauiTextView.TextAlignment.get -> UIKit.UITextAlignment | ||
| override Microsoft.Maui.Platform.MauiTextView.TextAlignment.set -> void |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.