[Android] Fix ScrollView scroll position changes unexpectedly when Orientation is set to Horizontal and FlowDirection is RTL at runtime - #32531
Conversation
eaaabb1 to
a347a64
Compare
🤖 AI Summary📊 Expand Full Review🔍 Pre-Flight — Context & Validation📝 Review Session — Fix the build errors ·
|
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #32531 | Track _checkedForRtlScroll flag + UpdateFlowDirection method + RTL scroll in OnLayout via ` PENDING (Gate) |
4 impl files | Original PR | Post()` |
🚦 Gate — Test Verification
📝 Review Session — Fix the build errors · 8aca2fa
** FAILEDResult:**
Platform: android
Mode: Full Verification
Test Behavior
- Tests FAIL without fix ( bug is present)expected
- Tests PASS with ( missing baseline snapshot)FAILED fix
Root Cause of Gate Failure
The test VerifyHorizontalScrollViewPositionAtRuntime uses VerifyScreenshot() which requires a pre-committed baseline .png snapshot file. No baseline snapshot was committed with this PR.
Error:
VisualTestUtils.VisualTestFailedException:
Baseline snapshot not yet created:
artifacts/bin/Controls.TestCases.Android.Tests/Debug/net10.0/snapshots/android/VerifyHorizontalScrollViewPositionAtRuntime.png
This means the test cannot differentiate between the buggy state and the fixed it fails unconditionally due to missing snapshot infrastructure.state
Required Fix
The PR author must either:
- Commit the baseline screenshot (
VerifyHorizontalScrollViewPositionAtRuntime.png) soVerifyScreenshot()works, OR - Replace
VerifyScreenshot()with a concrete, snapshot-independent assertion (e.g., checking the element's scroll position or bounding rect)
🔧 Fix — Analysis & Comparison
📝 Review Session — Fix the build errors · 8aca2fa
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #32531 | Track flag + + RTL scroll in | PASS (Gate - partially: fails without fix) | 4 impl files | Original skipped try-fix due to Gate failure |
Exhausted: No ( Gate failed, try-fix not executed)skipped
Selected Fix: PR's try-fix exploration was skipped because Gate did not fully pass (tests fail both with and without fix due to missing baseline snapshot)fix
📋 Report — Final Recommendation
📝 Review Session — Fix the build errors · 8aca2fa
Final Recommendation: REQUEST CHANGES##
Summary
PR #32531 adds RTL scroll position fix for Android ScrollView when Orientation=Horizontal and FlowDirection=RightToLeft. The fix approach is sound and the code quality is good, but the Gate verification failed because the test uses VerifyScreenshot() without a committed baseline snapshot, making the test unable to validate the fix.
Root Cause (of the original bug)
When MauiScrollView is used in horizontal mode with RTL layout direction on Android, changing orientation at runtime resets the LayoutDirection without repositioning the horizontal scroll offset to the right end. The fix tracks _checkedForRtlScroll and re-positions the horizontal scroll to the right edge via Post() in OnLayout.
Gate FAILEDResult:
- Tests FAIL without fix bug is detectable)correct (
- Tests FAIL with missing baseline snapshot)incorrect fix (
VerifyHorizontalScrollViewPositionAtRuntimeusesVerifyScreenshot()but no baseline.pngwas committed
Required Changes
1. Fix the missing baseline snapshottest
The test VerifyHorizontalScrollViewPositionAtRuntime calls VerifyScreenshot() but the baseline screenshot file was not committed. This means the test always fails regardless of the fix state.
Option A: Commit the baseline screenshot for all relevant platforms.
Option B (preferred): Replace VerifyScreenshot() with a concrete Appium-based assertion that does not require a pre-existing snapshot. For example, verify the scroll position of the horizontal scroll view element is at the right edge after toggling orientation:
[Test]
[Category(UITestCategories.ScrollView)]
public void VerifyHorizontalScrollViewPositionAtRuntime()
{
App.WaitForElement("ToggleOrientationButton");
App.Tap("ToggleOrientationButton");
// Verify RTL content is scrolled to the right edge (x position near 0 for RTL)
// Use element bounds to assert content is positioned correctly
App.WaitForElement("ScrollViewContent");
VerifyScreenshot(); // Only keep if baseline is committed
}2. Code quality observations (non-blocking)
- The
UpdateFlowDirectionmethod andMapFlowDirectionhandler look correct GetLayoutDirectionrefactoring inViewExtensions.csis a minimal but valid change- The
_checkedForRtlScroll = trueinOnScrollChangeis a reasonable optimization to avoid redundant scroll calls - Edge case: rapid orientation toggles may cause visible scroll flicker; consider adding a guard for in-flight post operations
Fix Quality (once test is fixed)
The core implementation is sound. The PR correctly:
- Tracks layout direction changes to avoid redundant work
- Resets RTL tracking when orientation changes
- Uses
Post()to defer RTL scroll positioning after layout completes - Registers
MapFlowDirectionmapper specifically for Android
Recommendation
Request the author to fix the test by committing baseline screenshots or replacing VerifyScreenshot() with concrete assertions. The fix code itself is correct.
📋 Expand PR Finalization Review
Title: ⚠️ Needs Update
Current: [Android] Fix ScrollView scroll position changes unexpectedly when Orientation is set to Horizontal and FlowDirection is RTL at runtime
Recommended: [Android] ScrollView: Fix RTL horizontal scroll position on orientation change
Description: ⚠️ Needs Update
Description needs updates. See details below.
✨ Suggested PR Description
[!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!
Root Cause
On Android, MauiHorizontalScrollView (the inner view used for horizontal scrolling) does not receive FlowDirection updates — only the outer NestedScrollView (MauiScrollView) did. When Orientation changed at runtime, a new _hScrollView was created without the correct LayoutDirection, so the scroll position was not initialized to the right-hand edge for RTL. This caused the scroll position to alternate unexpectedly between left and right edges each time orientation toggled.
Description of Change
src/Core/src/Platform/Android/ViewExtensions.cs
- Changed
GetLayoutDirectionfromprivatetointernalso it can be called fromMauiScrollViewwithout duplicating logic.
src/Core/src/Handlers/ScrollView/ScrollViewHandler.cs + ScrollViewHandler.Android.cs
- Registered a new Android-only
MapFlowDirectionmapper that callsMauiScrollView.UpdateFlowDirectionwhenIView.FlowDirectionchanges.
src/Core/src/Platform/Android/MauiScrollView.cs
- Added
UpdateFlowDirection(IView view)which setsLayoutDirectionon_hScrollView(horizontal) orthis(vertical/both). - Added
_checkedForRtlScrollflag that resets when orientation changes or whenFlowDirectionchanges, allowing RTL initial-position logic to re-run. - In
OnLayout, when RTL scroll is not yet positioned (_checkedForRtlScroll == false) and orientation is horizontal,Posts a scroll to the child's full width to position at the right edge. - In
IOnScrollChangeListener.OnScrollChange, sets_checkedForRtlScroll = trueso that once the user manually scrolls, the automatic RTL positioning does not override it.
Issues Fixed
Fixes #30081
Platforms Tested
- Android
- iOS (not affected — Android-only fix)
- Windows (not affected — Android-only fix)
- Mac (not affected — Android-only fix)
Code Review: ✅ Passed
Code Review — PR #32531
🟡 Suggestions
1. MapFlowDirection should be public, not internal
File: src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs
Problem: All other Map* methods in ScrollViewHandler are public static. Making MapFlowDirection internal breaks the pattern and prevents external consumers from overriding or calling the mapper directly (e.g., custom handlers derived from ScrollViewHandler).
Recommendation:
// Change:
internal static void MapFlowDirection(IScrollViewHandler handler, IScrollView scrollView)
// To:
public static void MapFlowDirection(IScrollViewHandler handler, IScrollView scrollView)2. UI test doesn't cover the alternating-position regression (core of the bug)
File: src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue30081.cs
Problem: The test taps once and takes a screenshot. The reported bug was that the position alternates on each toggle. A single tap only goes Vertical→Horizontal; it doesn't verify the position is stable across multiple toggles (the regression would need at least 2–3 toggles to manifest).
Recommendation: Consider tapping the toggle button multiple times and verifying the screenshot is consistent:
App.WaitForElement("ToggleOrientationButton");
App.Tap("ToggleOrientationButton"); // Vertical -> Horizontal
VerifyScreenshot("after_first_toggle");
App.Tap("ToggleOrientationButton"); // Horizontal -> Vertical
App.Tap("ToggleOrientationButton"); // Vertical -> Horizontal again
VerifyScreenshot("after_third_toggle"); // Should match first screenshotWithout this, the test may pass even if the alternating-position bug is not fixed.
3. ScrollOrientation.Both is not tested
File: src/Controls/tests/TestCases.HostApp/Issues/Issue30081.cs
Problem: The issue description explicitly states: "Note: This issue also arises when Orientation is set to Both." The MauiScrollView code for UpdateFlowDirection has a guard _scrollOrientation == ScrollOrientation.Horizontal so Both orientation is NOT handled by the same path. It falls through to the else branch which only sets this.LayoutDirection. It's unclear whether this fixes the Both case.
Recommendation: Add a test case or at least verify manually that ScrollOrientation.Both is also fixed.
4. Dead code in ScrollViewViewModel
File: src/Controls/tests/TestCases.HostApp/Issues/Issue30081.cs
Problem: The view model has ContentText property, _contentText backing field, and logic to create a new Label when ContentText changes. None of this is bound or used in the page — the content is set directly in the constructor and never changed through ContentText. This dead code adds noise and confusion.
Recommendation: Remove ContentText, _contentText, and the corresponding setter logic.
5. RTL initial scroll position may be inaccurate
File: src/Core/src/Platform/Android/MauiScrollView.cs
Problem: The RTL initial-scroll logic in OnLayout uses:
_hScrollView?.ScrollTo(_hScrollView?.GetChildAt(0)?.Width ?? 0, 0);This scrolls to the child's intrinsic Width, which may not equal the actual maximum scroll offset if the child has margins or if the horizontal scroll view's width is > 0. The correct maximum scroll offset is typically child.Width - hScrollView.Width for LTR, but for RTL Android already handles direction natively once LayoutDirection is set — so forcibly scrolling to child.Width may overshoot or undershoot.
Recommendation: Verify this is correct or consider using _hScrollView.MaxScrollAmount or computing max scroll as Math.Max(0, childWidth - hScrollViewWidth) to get the true end position.
6. Mixed indentation in Issue30081.cs
File: src/Controls/tests/TestCases.HostApp/Issues/Issue30081.cs
Problem: The file mixes 4-space indentation (constructor body at outer scope) and tab indentation (ScrollView, Button object initializers). This is inconsistent with the rest of the MAUI codebase.
Recommendation: Normalize to consistent tab (or space) indentation.
7. Platforms tested in description are inaccurate
File: PR description
Problem: iOS, Windows, and Mac are checked as tested, but the change is wrapped in #if ANDROID — it has no effect on those platforms. Checking them implies they were regression-tested, which may mislead reviewers.
Recommendation: Uncheck iOS, Windows, and Mac in the tested platforms list, or add a note explaining they were tested to confirm no regression.
✅ Looks Good
- The
_checkedForRtlScrollflag pattern is sound: reset on orientation change, reset on flow direction change, locked once user scrolls — prevents fighting with user interaction. - Making
GetLayoutDirectioninternalrather than duplicating the logic is the right approach. - Handler registration via
#if ANDROIDinScrollViewHandler.csis the established pattern for Android-only mappers in this file. Post()lambda correctly defers scroll until after layout is complete, avoiding scroll-before-measure issues.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Pull request overview
Fixes Android RTL behavior for horizontally scrolling ScrollView when orientation/flow direction changes at runtime, addressing the unexpected scroll position shifts reported in #30081.
Changes:
- Exposes Android
GetLayoutDirection(IView)helper for reuse outsideViewExtensions. - Adds Android-specific FlowDirection mapping and RTL scroll-position correction logic in
MauiScrollView. - Adds a UI test + HostApp issue page for Issue30081.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Core/src/Platform/Android/ViewExtensions.cs | Makes GetLayoutDirection(IView) internal so other Android platform code can reuse it. |
| src/Core/src/Platform/Android/MauiScrollView.cs | Tracks layout direction and applies RTL-specific scroll positioning for horizontal scrolling scenarios. |
| src/Core/src/Handlers/ScrollView/ScrollViewHandler.cs | Adds Android-only mapper entry for IView.FlowDirection on ScrollViewHandler. |
| src/Core/src/Handlers/ScrollView/ScrollViewHandler.Android.cs | Implements MapFlowDirection to route FlowDirection updates to MauiScrollView. |
| src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue30081.cs | Adds a UI test intended to catch the RTL/horizontal runtime scroll position regression. |
| src/Controls/tests/TestCases.HostApp/Issues/Issue30081.cs | Adds the HostApp reproduction page used by the UI test. |
Comments suppressed due to low confidence (1)
src/Core/src/Platform/Android/MauiScrollView.cs:201
- Resetting
_checkedForRtlScrollonly when the orientation changes may not cover the other repro path mentioned in the issue: updating/replacing ScrollView content at runtime while staying in horizontal/RTL. In that case a new layout may occur but_checkedForRtlScrollremainstrue, so the RTL correction path won’t re-evaluate. Consider also resetting this flag when the horizontal scroller is (re)created / content is swapped into_hScrollView(e.g., when_hScrollViewis first created or when_contentis moved between parents).
public void SetOrientation(ScrollOrientation orientation)
{
bool orientationChanged = _scrollOrientation != orientation;
_scrollOrientation = orientation;
// Reset RTL tracking when orientation changes
if (orientationChanged)
{
_checkedForRtlScroll = false;
}
if (orientation == ScrollOrientation.Horizontal || orientation == ScrollOrientation.Both)
{
if (_hScrollView == null)
{
_hScrollView = new MauiHorizontalScrollView(Context, this)
{
FillViewport = true
};
_hScrollView.HorizontalFadingEdgeEnabled = HorizontalFadingEdgeEnabled;
_hScrollView.SetFadingEdgeLength(HorizontalFadingEdgeLength);
SetHorizontalScrollBarVisibility(_horizontalScrollVisibility);
}
_hScrollView.IsBidirectional = _isBidirectional = orientation == ScrollOrientation.Both;
if (_hScrollView.Parent != this)
{
if (_content != null)
{
_content.RemoveFromParent();
_hScrollView.AddView(_content);
}
AddView(_hScrollView);
}
// If the user has changed between horiztonal and both we want to request a new layout
// so the Horizontal Layout can be adjusted to satisfy the new orientation.
else if (orientationChanged)
{
PlatformInterop.RequestLayoutIfNeeded(this);
}
}
|
/review -b feature/refactor-copilot-yml |
kubaflo
left a comment
There was a problem hiding this comment.
Could you please check the ai's suggestions?
|
/review -b feature/enhanced-reviewer -p android |
kubaflo
left a comment
There was a problem hiding this comment.
Could you please check the ai's suggestions?
020f65d to
1557bd0
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
…ientation is set to Horizontal and FlowDirection is RTL at runtime (#32531) <!-- 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! <!-- !!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING MAIN. !!!!!!! --> ### Issue Details Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience. ### Description of Change <!-- Enter description of the fix in this section --> Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes. ### Issues Fixed <!-- Please make sure that there is a bug logged for the issue being fixed. The bug should describe the problem and how to reproduce it. --> Fixes #30081 <!-- Are you targeting main? All PRs should target the main branch unless otherwise noted. --> **Tested the behavior in the following platforms.** - [x] Android - [x] Windows - [x] iOS - [x] Mac | Before | After | |---------|--------| | **Android**<br> <video src="https://github.com/user-attachments/assets/e15ff748-354d-49f6-9c09-f6e52eb51a27" width="300" height="600"> | **Android**<br> <video src="https://github.com/user-attachments/assets/f91f91b0-d529-4711-93bc-92a2cc21f702" width="300" height="600"> | --------- Co-authored-by: KarthikRajaKalaimani <92777139+KarthikRajaKalaimani@users.noreply.github.com>
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
Horizontal ScrollViews with FlowDirection=RightToLeft incorrectly position content at the left edge instead of the right edge on Android, breaking RTL user experience.
Description of Change
Added orientation tracking and improved RTL handling in Android ScrollView to maintain correct scroll position during orientation or flow direction changes.
Issues Fixed
Fixes #30081
Tested the behavior in the following platforms.
Before.mov
After.mov