-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix RTL label padding on iOS and Android #32333
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
Open
kubaflo
wants to merge
2
commits into
dotnet:main
Choose a base branch
from
kubaflo:fix-Issue32316
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
There are no files selected for viewing
Binary file modified
BIN
-16 Bytes
(100%)
....Tests/snapshots/android/ButtonsLayoutResolveWhenParentSizeChangesOriginal2.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
+25.1 KB
...ls/tests/TestCases.Android.Tests/snapshots/android/RTLModePaddingShouldWork.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
+35 Bytes
(100%)
...estCases.Android.Tests/snapshots/android/RightToLeftFlowDirectionShouldWork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions
101
src/Controls/tests/TestCases.HostApp/Issues/Issue32316.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,101 @@ | ||
| namespace Maui.Controls.Sample.Issues; | ||
|
|
||
| [Issue(IssueTracker.Github, 32316, "RTL mode: Padding for the label is not mirroring properly", PlatformAffected.iOS | PlatformAffected.Android)] | ||
| public class Issue32316 : ContentPage | ||
| { | ||
| private readonly HorizontalStackLayout _row1; | ||
| private readonly HorizontalStackLayout _row2; | ||
|
|
||
| public Issue32316() | ||
| { | ||
| var toggleButton = new Button | ||
| { | ||
| Text = "Toggle FlowDirection", | ||
| AutomationId = "ToggleFlowDirectionButton", | ||
| HorizontalOptions = LayoutOptions.Center | ||
| }; | ||
|
|
||
| toggleButton.Clicked += OnToggleClicked; | ||
|
|
||
| _row1 = BuildRow(); | ||
| _row2 = BuildRow(); | ||
|
|
||
| Content = new VerticalStackLayout | ||
| { | ||
| Spacing = 12, | ||
| Padding = 12, | ||
| Children = | ||
| { | ||
| toggleButton, | ||
| _row1, | ||
| _row2, | ||
| } | ||
| }; | ||
| } | ||
|
|
||
| private void OnToggleClicked(object sender, EventArgs e) | ||
| { | ||
| _row2.FlowDirection = FlowDirection.RightToLeft; | ||
| } | ||
|
|
||
| private static HorizontalStackLayout BuildRow() | ||
| { | ||
| var stackLayout = new HorizontalStackLayout | ||
| { | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| }; | ||
|
|
||
| stackLayout.Children.Add(CreateIconBorder("✂")); | ||
| stackLayout.Children.Add(CreateIconBorder("✖")); | ||
|
|
||
| return stackLayout; | ||
| } | ||
|
|
||
| private static View CreateIconBorder(string icon) | ||
| { | ||
| return new Border | ||
| { | ||
| BackgroundColor = Colors.LightGray, | ||
| Stroke = Colors.Gray, | ||
| StrokeThickness = 1, | ||
| WidthRequest = 60, | ||
| HeightRequest = 40, | ||
| InputTransparent = true, | ||
| Content = CreateIconView(icon) | ||
| }; | ||
| } | ||
|
|
||
| private static View CreateIconView(string icon) | ||
| { | ||
| var iconLabel = new Label | ||
| { | ||
| Text = icon, | ||
| FontSize = 16, | ||
| FontAutoScalingEnabled = false, | ||
| Padding = new Thickness(10, 0, 0, 0), | ||
| HorizontalOptions = LayoutOptions.Start, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| VerticalTextAlignment = TextAlignment.Center, | ||
| BackgroundColor = Colors.Transparent, | ||
| HeightRequest = 40 | ||
| }; | ||
|
|
||
| var dropDownLabel = new Label | ||
| { | ||
| Text = "V", | ||
| FontSize = 16, | ||
| Margin = new Thickness(0, 0, 10, 0), | ||
| FontFamily = "MauiMaterialAssets", | ||
| VerticalTextAlignment = TextAlignment.Center, | ||
| VerticalOptions = LayoutOptions.Center, | ||
| BackgroundColor = Colors.Transparent | ||
| }; | ||
|
|
||
| return new HorizontalStackLayout | ||
| { | ||
| HorizontalOptions = LayoutOptions.Center, | ||
| HeightRequest = 40, | ||
| Children = { iconLabel, dropDownLabel } | ||
| }; | ||
| } | ||
| } |
Binary file added
BIN
+11 KB
src/Controls/tests/TestCases.Mac.Tests/snapshots/mac/RTLModePaddingShouldWork.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions
24
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32316.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,24 @@ | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues; | ||
|
|
||
| public class Issue32316 : _IssuesUITest | ||
| { | ||
|
|
||
| public Issue32316(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "RTL mode: Padding for the label is not mirroring properly"; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Label)] | ||
| public void RTLModePaddingShouldWork() | ||
| { | ||
| App.WaitForElement("ToggleFlowDirectionButton"); | ||
| App.Tap("ToggleFlowDirectionButton"); | ||
| VerifyScreenshot(); | ||
| } | ||
| } | ||
Binary file added
BIN
+9.81 KB
...rols/tests/TestCases.WinUI.Tests/snapshots/windows/RTLModePaddingShouldWork.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
+35.6 KB
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/RTLModePaddingShouldWork.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
+37 Bytes
(100%)
.../tests/TestCases.iOS.Tests/snapshots/ios/RightToLeftFlowDirectionShouldWork.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
+691 Bytes
(100%)
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/WebViewShouldNotMirrored.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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pending snapshots, running a build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Snapshots are available in the latest build.

Could you commit the images?