-
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
base: main
Are you sure you want to change the base?
Conversation
Corrects label padding handling in RTL mode by using SetPaddingRelative on Android and flipping left/right insets on iOS. Adds test cases and UI tests to verify correct padding mirroring for labels in RTL layouts.
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.
Pull Request Overview
This pull request fixes an issue where label padding does not properly mirror in RTL (right-to-left) mode on iOS and Android platforms. The fix ensures that when a layout direction is set to RTL, the left and right padding values are swapped appropriately.
Key Changes:
- iOS: Modified
MauiLabel.DrawTextto swap left/right insets when in RTL layout direction - Android: Changed
SetPaddingtoSetPaddingRelativeto use Android's built-in RTL support - Added UI tests to validate RTL padding behavior
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/Core/src/Platform/iOS/MauiLabel.cs | Adds RTL-aware inset flipping logic to swap left/right text insets when layout direction is RTL |
| src/Core/src/Platform/Android/TextViewExtensions.cs | Changes from absolute padding to relative padding method for automatic RTL support |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue32316.cs | Adds NUnit test implementation to validate RTL padding behavior |
| src/Controls/tests/TestCases.HostApp/Issues/Issue32316.cs | Creates test UI page demonstrating label padding with RTL flow direction toggling |
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
| { | ||
| App.WaitForElement("ToggleFlowDirectionButton"); | ||
| App.Tap("ToggleFlowDirectionButton"); | ||
| VerifyScreenshot(); |
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.
|
/azp run MAUI-public |
|
Azure Pipelines successfully started running 1 pipeline(s). |

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
Corrects label padding handling in RTL mode by using SetPaddingRelative on Android and flipping left/right insets on iOS. Adds test cases and UI tests to verify correct padding mirroring for labels in RTL layouts.
Issues Fixed
Fixes #32316