Repository navigation
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c912532c-4649-4359-bbb8-aa0f74d7665e
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37232Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37232" |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
This PR restores horizontal drag-scrolling for long selected Picker text on Android (standard and Material 3) while keeping the control read-only and preventing a drag gesture from also triggering a click to open the picker.
Changes:
- Introduces a
PickerScrollingMovementMethodwrapper over Android’sScrollingMovementMethodto enable horizontal scrolling and suppress post-drag clicks. - Updates
MauiPickerBaseandMauiMaterialPickerBaseto use the new movement method (cached per control instance). - Adds an Android device test covering scroll, tap, drag-without-click, and tap-after-drag for both picker variants.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Core/tests/DeviceTests/Handlers/Picker/PickerHandlerTests.Android.cs | Adds device test validating horizontal scrolling and click suppression for standard + Material pickers. |
| src/Core/src/Platform/Android/PickerScrollingMovementMethod.cs | New movement method wrapper to enable scrolling and suppress click after horizontal drag. |
| src/Core/src/Platform/Android/MauiPicker.cs | Enables the new movement method for the standard Android picker platform view. |
| src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs | Enables the new movement method for the Material 3 picker platform view. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c912532c-4649-4359-bbb8-aa0f74d7665e
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.
Suppressed comments (1)
src/Core/src/Platform/Android/PickerScrollingMovementMethod.cs:27
- Avoid null-forgiving operators when retrieving touch slop.
widget.Contextis non-null andViewConfiguration.Get(...)is used throughout the codebase without null checks; the current!chain risks hiding a real null and would turn it into an NRE on touch.
case MotionEventActions.Down:
_downX = e.GetX();
_touchSlop = ViewConfiguration.Get(widget.Context!)!.ScaledTouchSlop;
_isDragging = false;
This comment has been minimized.
This comment has been minimized.
MauiBot
left a comment
There was a problem hiding this comment.
Expert Review — 7 findings
See inline comments for details.
This comment has been minimized.
This comment has been minimized.
Suppress posted Picker clicks in PerformClick after horizontal or vertical drag gestures, including fast swipes that cross touch slop on ACTION_UP. Preserve read-only behavior and expand Android device coverage for standard and Material Pickers. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c912532c-4649-4359-bbb8-aa0f74d7665e
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
@MauiBot addressed the current actionable review gap in |
AI Review Summary
🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After FixGate Result: ✅ PASSEDPlatform: ANDROID · Base: main · Merge base: ✅ Verified (new API / feature) — this PR adds new API and a test that references it in the same project, so reverting the fix un-compiles the test: there is no valid "fails without the fix" baseline to establish (a compile-coupled baseline). The gate instead verified the fix by a clean build + pass with the fix, so this is a real PASS rather than a non-committal INCONCLUSIVE.
🔴 Without fix — 📱 PickerHandlerTests (LongSelectedTextScrollsHorizontallyAndRemainsReadOnly, TapJitterClicksButFastSwipeDoesNot, VerticalDragDoesNotClick, CanceledDragDoesNotSuppressNextTap, PointerReplacementWithoutMovementRemainsATap, MovementMethodRemainsDisabled): 🛠️ BUILD ERROR · 260sError-relevant lines (filtered from the build log): 🟢 With fix — 📱 PickerHandlerTests (LongSelectedTextScrollsHorizontallyAndRemainsReadOnly, TapJitterClicksButFastSwipeDoesNot, VerticalDragDoesNotClick, CanceledDragDoesNotSuppressNextTap, PointerReplacementWithoutMovementRemainsATap, MovementMethodRemainsDisabled): PASS ✅ · 407s(no coded error found; showing last 1200 chars)
|
| # | Approach | Result | Findings | Artifacts |
|---|---|---|---|---|
| 1 | Own viewport with Layout-clamped ScrollTo; veto PerformClick |
✅ Pass | 2 minor | try-fix/attempt-1/, try-fix-1/content.md |
| 2 | Native BringPointIntoView; intercept drag terminal events in DispatchTouchEvent |
✅ Pass | 0 | try-fix/attempt-2/, try-fix-2/content.md |
Candidate 1 (preserved)
PR #37232 — Try-Fix Candidate 1
Result: ✅ Pass · Self-review findings: 2 (0 critical, 0 major, 2 minor) · Test runs used: 1 of 2 permitted (no correction round needed)
Files changed:
| File | Change |
|---|---|
src/Core/src/Platform/Android/PickerDragGestureFilter.cs |
Rewritten (drag classification + viewport scrolling) |
src/Core/src/Platform/Android/MauiPicker.cs |
+35 / -0 (OnTouchEvent, PerformClick, ctor property re-assert) |
src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs |
+36 / -0 (same, Material 3 view) |
src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt |
+2 (MauiPickerBase.OnTouchEvent, MauiPickerBase.PerformClick) |
Approach: Own the viewport — scroll the Picker's own scroll offset, arbitrate the click at PerformClick()
Root-cause hypothesis (different from the PR's): The PR assumes the scroll was lost because nothing drives the text machinery on touch, so it re-attaches that machinery (ScrollingMovementMethod.Instance.OnTouchEvent(...)) and then has to undo the side effects of the base gesture after the fact by fabricating an ACTION_CANCEL and re-dispatching it into base.OnTouchEvent.
This candidate treats the Picker as what it actually is: a button whose label is wider than its viewport. The selected value is a rendered, read-only label — the view already owns a scroll offset (ScrollX/ScrollY). So the fix is to move the view's own viewport during a drag using the Layout's line geometry for bounds, and to treat the "no click after a drag" requirement as a click-dispatch concern rather than a touch-pipeline concern: the drag state simply vetoes the next PerformClick().
Implementation:
PickerDragGestureFilter(rewritten from scratch) does two things, both pure UI-thread state machine work:ShouldCancelClick(view, e)— touch-slop / active-pointer classification (this API shape is fixed by the existing device testPointerReplacementWithoutMovementRemainsATap). Anchor is captured onDOWN, drag is classified onMOVEand onUP(so a fast swipe whose movement is only visible atUPstill counts), the active pointer is re-anchored onPOINTER_UP, andCANCEL/DOWNreset the state.ScrollSelectedText(textView, e)— applies the incremental active-pointer delta toView.ScrollTo, clamped to the textLayout's ownGetLineLeft(0)/GetLineRight(0)/Heightgeometry so LTR, RTL and aligned text all clamp correctly, and vertical scrolling is a no-op for the single-line Picker.
MauiPickerBase/MauiMaterialPickerBaseoverrideOnTouchEventonly to feed the filter (they never fabricate or re-dispatch events, and never touchMovementMethod), and overridePerformClick()to veto exactly one click when the gesture was classified as a drag. The veto is cleared on the nextACTION_DOWN, so a canceled drag cannot swallow the following tap.MovementMethodstaysnull; read-only state (InputTypes.Null,KeyListener == null) is untouched.Focusable/FocusableInTouchMode/Clickable/LongClickableare re-asserted afterPickerManager.InitbecauseTextView.setKeyListener(null)resets clickable/focusable — that is a precondition for any fix here, not the strategy.
Different from the existing fix:
| PR #37232 | This candidate | |
|---|---|---|
| Scroll source | ScrollingMovementMethod.Instance.OnTouchEvent (text machinery) |
The view's own ScrollTo, clamped by Layout line geometry |
| Click suppression | Fabricate MotionEvent with ACTION_CANCEL and re-dispatch into base.OnTouchEvent |
Veto the click at PerformClick(); base touch pipeline is never perturbed |
| Events created | Yes (synthetic MotionEvent.Obtain per drag) |
None |
| Pressed-state handling | Relies on the injected cancel to clear pressed/prepressed + pending callbacks | Base view keeps its normal pressed lifecycle; only the click callback is vetoed |
Explicitly avoided (previously rejected): ArrowKeyMovementMethod, OnTouchListener-based scrolling, clearing only View.Pressed, MOVE-only or X-only drag classification.
Captured Diff
diff --git a/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs b/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
index 367209bc0f..68b638727b 100644
--- a/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
+++ b/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
@@ -1,5 +1,6 @@
using Android.Content;
using Android.Text.Method;
+using Android.Views;
using AndroidX.Core.Graphics.Drawable;
using Google.Android.Material.TextField;
@@ -11,6 +12,12 @@ internal class MauiMaterialPicker : MauiMaterialPickerBase
public MauiMaterialPicker(Context context) : base(context)
{
PickerManager.Init(this);
+
+ // Setting a null KeyListener resets these, and the Picker still has to behave like a button.
+ Focusable = true;
+ FocusableInTouchMode = false;
+ Clickable = true;
+ LongClickable = false;
}
protected override void Dispose(bool disposing)
@@ -27,6 +34,9 @@ internal class MauiMaterialPicker : MauiMaterialPickerBase
// TODO: Material3 - make it public in .net 11
internal class MauiMaterialPickerBase : TextInputEditText
{
+ readonly PickerDragGestureFilter _dragGestureFilter = new();
+ bool _suppressClick;
+
public MauiMaterialPickerBase(Context context) : base(MauiMaterialContextThemeWrapper.Create(context))
{
if (Background is not null)
@@ -37,5 +47,31 @@ internal class MauiMaterialPickerBase : TextInputEditText
// MovementMethod handles cursor positioning, scrolling, and text selection (per Android docs).
// Since text is readonly, we disable it to avoid unnecessary cursor navigation during keyboard input.
+ // The selected text is instead scrolled by moving this view's own scroll offset.
protected override IMovementMethod? DefaultMovementMethod => null;
+
+ public override bool OnTouchEvent(MotionEvent? e)
+ {
+ if (e?.ActionMasked == MotionEventActions.Down)
+ _suppressClick = false;
+
+ if (_dragGestureFilter.ShouldCancelClick(this, e))
+ _suppressClick = true;
+
+ _dragGestureFilter.ScrollSelectedText(this, e);
+
+ return base.OnTouchEvent(e);
+ }
+
+ public override bool PerformClick()
+ {
+ // A drag is not a tap, so veto the click the base view is about to raise.
+ if (_suppressClick)
+ {
+ _suppressClick = false;
+ return false;
+ }
+
+ return base.PerformClick();
+ }
}
diff --git a/src/Core/src/Platform/Android/MauiPicker.cs b/src/Core/src/Platform/Android/MauiPicker.cs
index 5a3e987934..6a4f1bb8d2 100644
--- a/src/Core/src/Platform/Android/MauiPicker.cs
+++ b/src/Core/src/Platform/Android/MauiPicker.cs
@@ -14,6 +14,12 @@ namespace Microsoft.Maui.Platform
public MauiPicker(Context context) : base(context)
{
PickerManager.Init(this);
+
+ // Setting a null KeyListener resets these, and the Picker still has to behave like a button.
+ Focusable = true;
+ FocusableInTouchMode = false;
+ Clickable = true;
+ LongClickable = false;
}
protected override void Dispose(bool disposing)
@@ -27,6 +33,9 @@ namespace Microsoft.Maui.Platform
public class MauiPickerBase : AppCompatEditText
{
+ readonly PickerDragGestureFilter _dragGestureFilter = new();
+ bool _suppressClick;
+
public MauiPickerBase(Context context) : base(context)
{
if (Background != null)
@@ -35,6 +44,32 @@ namespace Microsoft.Maui.Platform
// MovementMethod handles cursor positioning, scrolling, and text selection (per Android docs).
// Since text is readonly, we disable it to avoid unnecessary cursor navigation during keyboard input.
+ // The selected text is instead scrolled by moving this view's own scroll offset.
protected override IMovementMethod? DefaultMovementMethod => null;
+
+ public override bool OnTouchEvent(MotionEvent? e)
+ {
+ if (e?.ActionMasked == MotionEventActions.Down)
+ _suppressClick = false;
+
+ if (_dragGestureFilter.ShouldCancelClick(this, e))
+ _suppressClick = true;
+
+ _dragGestureFilter.ScrollSelectedText(this, e);
+
+ return base.OnTouchEvent(e);
+ }
+
+ public override bool PerformClick()
+ {
+ // A drag is not a tap, so veto the click the base view is about to raise.
+ if (_suppressClick)
+ {
+ _suppressClick = false;
+ return false;
+ }
+
+ return base.PerformClick();
+ }
}
}
\ No newline at end of file
diff --git a/src/Core/src/Platform/Android/PickerDragGestureFilter.cs b/src/Core/src/Platform/Android/PickerDragGestureFilter.cs
index d4401a7fa6..f52fbb2a3c 100644
--- a/src/Core/src/Platform/Android/PickerDragGestureFilter.cs
+++ b/src/Core/src/Platform/Android/PickerDragGestureFilter.cs
@@ -1,18 +1,25 @@
using Android.Views;
+using Android.Widget;
using AView = Android.Views.View;
namespace Microsoft.Maui.Platform;
+// The Picker renders a read-only label that can be wider than its viewport. Because the Picker has no
+// MovementMethod, nothing moves that viewport during a drag, so this filter tracks the active pointer,
+// moves the view's own scroll offset, and reports when a gesture stopped being a tap.
sealed class PickerDragGestureFilter
{
+ const int InvalidPointerId = -1;
+
int _touchSlop;
int _activePointerId = InvalidPointerId;
float _anchorX;
float _anchorY;
+ float _lastX;
+ float _lastY;
bool _isDrag;
- const int InvalidPointerId = -1;
-
+ // Returns true only on the event where the gesture is first classified as a drag.
public bool ShouldCancelClick(AView view, MotionEvent? e)
{
if (e is null)
@@ -28,16 +35,17 @@ sealed class PickerDragGestureFilter
_anchorY = e.GetY(0);
_isDrag = false;
return false;
+
+ // A fast swipe can report all of its movement on the up event, so classify there too.
case MotionEventActions.Move:
+ case MotionEventActions.Up:
return TryClassifyDrag(e);
+
case MotionEventActions.PointerUp:
- var cancelClick = TryClassifyDrag(e);
- ReAnchor(e);
- return cancelClick;
- case MotionEventActions.Up:
- cancelClick = TryClassifyDrag(e);
- Reset();
- return cancelClick;
+ var classified = TryClassifyDrag(e);
+ ReAnchorActivePointer(e);
+ return classified;
+
case MotionEventActions.Cancel:
Reset();
return false;
@@ -46,6 +54,53 @@ sealed class PickerDragGestureFilter
return false;
}
+ // Moves the Picker's own scroll offset while a drag is in progress and keeps the pointer position in sync.
+ public void ScrollSelectedText(TextView view, MotionEvent? e)
+ {
+ if (e is null || _activePointerId == InvalidPointerId)
+ return;
+
+ var pointerIndex = e.FindPointerIndex(_activePointerId);
+
+ if (pointerIndex < 0)
+ return;
+
+ var x = e.GetX(pointerIndex);
+ var y = e.GetY(pointerIndex);
+ var action = e.ActionMasked;
+
+ if (_isDrag && (action == MotionEventActions.Move || action == MotionEventActions.Up))
+ ScrollBy(view, _lastX - x, _lastY - y);
+
+ _lastX = x;
+ _lastY = y;
+ }
+
+ static void ScrollBy(TextView view, float deltaX, float deltaY)
+ {
+ var layout = view.Layout;
+
+ if (layout is null || layout.LineCount == 0)
+ return;
+
+ // Every one of these properties crosses the Java/C# bridge, and this runs on every touch move.
+ var currentScrollX = view.ScrollX;
+ var currentScrollY = view.ScrollY;
+ var availableWidth = view.Width - view.CompoundPaddingLeft - view.CompoundPaddingRight;
+ var availableHeight = view.Height - view.CompoundPaddingTop - view.CompoundPaddingBottom;
+
+ // The layout reports where the text actually sits, so alignment and RTL are already accounted for.
+ var minScrollX = (int)global::System.Math.Floor(global::System.Math.Min(0f, layout.GetLineLeft(0)));
+ var maxScrollX = (int)global::System.Math.Ceiling(global::System.Math.Max(0f, layout.GetLineRight(0) - availableWidth));
+ var maxScrollY = global::System.Math.Max(0, layout.Height - availableHeight);
+
+ var scrollX = global::System.Math.Clamp((int)global::System.Math.Round(currentScrollX + deltaX), minScrollX, maxScrollX);
+ var scrollY = global::System.Math.Clamp((int)global::System.Math.Round(currentScrollY + deltaY), 0, maxScrollY);
+
+ if (scrollX != currentScrollX || scrollY != currentScrollY)
+ view.ScrollTo(scrollX, scrollY);
+ }
+
bool TryClassifyDrag(MotionEvent e)
{
if (_isDrag || _activePointerId == InvalidPointerId)
@@ -66,7 +121,9 @@ sealed class PickerDragGestureFilter
return true;
}
- void ReAnchor(MotionEvent e)
+ // When the finger that started the gesture leaves, keep tracking with a remaining finger instead of
+ // treating the pointer swap as movement.
+ void ReAnchorActivePointer(MotionEvent e)
{
var actionIndex = e.ActionIndex;
diff --git a/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
index 01d355e5ff..255ed189ba 100644
--- a/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
+++ b/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
@@ -25,3 +25,5 @@ override Microsoft.Maui.Platform.MauiSwipeRefreshLayout.OnInterceptTouchEvent(An
override Microsoft.Maui.Platform.MauiWebView.Dispose(bool disposing) -> void
override Microsoft.Maui.Platform.MauiWebView.OnDetachedFromWindow() -> void
override Microsoft.Maui.Platform.MauiWebView.OnTouchEvent(Android.Views.MotionEvent? e) -> bool
+override Microsoft.Maui.Platform.MauiPickerBase.OnTouchEvent(Android.Views.MotionEvent? e) -> bool
+override Microsoft.Maui.Platform.MauiPickerBase.PerformClick() -> boolTest Command and Results
Exact command (the only permitted one, run once):
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform android -TestFilter "Category=Picker"
Outcome: Tests run: 121 Passed: 119 Inconclusive: 0 Failed: 0 Ignored: 2 — XHarness exit code 0 (SUCCESS), Android emulator API 30 (emulator-5554). Single pass: no compile-error iteration, no runtime-failure correction round.
| Required test | Result |
|---|---|
LongSelectedTextScrollsHorizontallyAndRemainsReadOnly (4 theory cases) |
✅ PASS |
TapJitterClicksButFastSwipeDoesNot |
✅ PASS |
VerticalDragDoesNotClick |
✅ PASS |
CanceledDragDoesNotSuppressNextTap |
✅ PASS |
PointerReplacementWithoutMovementRemainsATap |
✅ PASS |
MovementMethodRemainsDisabled |
✅ PASS |
Full log: CustomAgentLogsTmp/PRState/37232/PRAgent/try-fix/attempt-1/test-output.log
Expert Self-Review (inline, maui-expert-reviewer rules)
findings_count: 2 — 0 critical, 0 major, 2 minor. One pre-test correction was applied from the Android performance-hot-path rule (cache ScrollX/ScrollY JNI reads in locals on the per-touch-move scroll path).
[
{
"path": "src/Core/src/Platform/Android/MauiPicker.cs",
"line": 62,
"body": "**[minor] Logic and Correctness** — The click veto is cleared on the next ACTION_DOWN or when it is consumed by PerformClick(). If a drag ends without the base view raising a click (for example the parent steals the gesture and the view only sees ACTION_UP after a drag), a programmatic or accessibility-initiated PerformClick() arriving before the next touch DOWN would be swallowed once. Bounded to a single click and self-healing on the next gesture, so accepted rather than adding more state."
},
{
"path": "src/Core/src/Platform/Android/PickerDragGestureFilter.cs",
"line": 72,
"body": "**[minor] Regression Prevention** — _isDrag is intentionally not reset on ACTION_UP (unlike the PR variant) so that ScrollSelectedText can apply the final UP delta and PerformClick can still see the drag when the click callback is posted rather than invoked inline. State is fully reset on the next ACTION_DOWN and on ACTION_CANCEL, so no stale drag can leak into a later gesture."
}
]Recorded at CustomAgentLogsTmp/PRState/37232/PRAgent/try-fix/attempt-1/reviewer-findings.json (diff snapshot unchanged after the test loop, so no Step 7.5 refresh was required).
Analysis
Result: Pass
What happened: pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform android -TestFilter "Category=Picker" built and ran on the Android emulator (API 30, emulator-5554) in a single pass — no compile-error iteration and no correction round was needed. Result: Tests run: 121, Passed: 119, Failed: 0, Ignored: 2, XHarness exit code 0. All six mandated methods reported [PASS]:
Long Selected Text Scrolls Horizontally And Remains Read Only(all 4 theory cases: standard/Material × normal/delayed pressed state)Picker Tap Jitter Clicks But Fast Swipe Does NotPicker Vertical Drag Does Not ClickPicker Canceled Drag Does Not Suppress Next TapPicker Pointer Replacement Without Movement Remains A TapPicker Movement Method Remains Disabled
Why it worked: The selected value is a read-only rendered label, so the missing behavior was never really about the text machinery — it was about nobody moving the view's own viewport. Moving ScrollX/ScrollY directly, clamped to the Layout's own GetLineLeft(0)/GetLineRight(0)/Height geometry, restores horizontal drag scrolling without reinstating any MovementMethod (so MovementMethod stays null and read-only state, InputTypes.Null + null KeyListener, is untouched). Because TextView.setKeyListener(null) resets clickable/focusable, Focusable/FocusableInTouchMode/Clickable/LongClickable are re-asserted after PickerManager.Init — that is a precondition for any fix in this area, not the strategy.
The click side is handled as a dispatch concern rather than a touch-pipeline concern: the drag classifier (touch slop + active pointer, classifying on MOVE and on UP so a fast swipe whose movement is only visible at ACTION_UP still counts) raises a one-shot veto that PerformClick() consumes. That means the base view's pressed/prepressed lifecycle and pending callbacks are never perturbed, so:
- the delayed-pressed-state host (
ShouldDelayChildPressedState() => true) still works, because the postedPerformClickrunnable is what gets vetoed, not the prepressed bookkeeping; - an
ACTION_CANCELmid-drag cannot leave residue, because the veto is cleared on the nextACTION_DOWN; - no synthetic
MotionEventis ever created or re-dispatched.
Self-review: 2 findings, both [minor], both accepted rather than fixed — (1) a programmatic/accessibility PerformClick() arriving after a drag but before the next ACTION_DOWN could be swallowed once (bounded, self-healing); (2) _isDrag is deliberately not reset on ACTION_UP so the final UP delta can scroll and a posted click can still see the drag — full reset happens on the next ACTION_DOWN and on ACTION_CANCEL. One correction was applied before testing, from the Android performance-hot-path rule: ScrollX/ScrollY JNI reads are now cached in locals since the scroll path runs on every touch move.
Insights:
- The touch-slop/active-pointer classifier is effectively specified by the device test (
PointerReplacementWithoutMovementRemainsATapconstructsPickerDragGestureFilterdirectly and assertsShouldCancelClickreturnsfalseforDOWN → POINTER_DOWN → POINTER_UP → UPwith no movement), so any candidate must keep that type and semantics. The real design space is how you scroll and how you suppress the click. - Classification must happen on
ACTION_UPtoo, not justACTION_MOVE— theDispatchSwipeWithoutMoveregression sendsDOWNthenUPwith no interveningMOVE. - The Picker's
EditTextis implicitly single-line/horizontally-scrolling becausePickerManager.InitsetsInputType = InputTypes.Null, andTextView.setInputTypeappliesapplySingleLine(true, …)for non-multiline types. That is why the layout is wider than the viewport andScrollXcan exceed 0 at all; a wrapped (multi-line) layout would makemaxScrollXzero. - Vertical clamping falls out for free: single-line means
layout.Height <= availableHeight, somaxScrollYis 0 and a vertical drag scrolls nothing while still correctly suppressing the click.
Baseline
Baseline established and restored with .github/scripts/EstablishBrokenBaseline.ps1 only. Worktree restored: src/Core is clean and the 36 pre-existing unrelated modifications under .github/ and eng/ are intact and unmodified.
Candidate 2
PR #37232 — Try-Fix Candidate 2
Result: ✅ Pass · Self-review findings: 0 · Test runs used: 1 of 2 permitted (no correction/retest)
Approach: Native point-reveal scrolling with terminal-event interception
PickerDragGestureFilter tracks touch slop, both axes, the active pointer, and incremental horizontal movement. Instead of calling a MovementMethod or directly setting the viewport, it asks Android TextView.BringPointIntoView to reveal the character beyond the visible edge; Android's native text layout owns scrolling, clamping, alignment, and RTL.
Both Picker bases override DispatchTouchEvent, not OnTouchEvent. After a drag is classified on MOVE or UP, the filter cancels pending input callbacks, clears pressed state, and consumes the remainder of that stream. Consequently the base EditText never receives a terminal UP for a drag, while taps and sub-slop jitter use the untouched native dispatch path. DOWN, UP, and CANCEL reset state; POINTER_UP reanchors to a remaining active pointer. Constructors reassert button semantics after the null key listener changes Android defaults. MovementMethod remains null.
Materially different: The PR re-enters ScrollingMovementMethod and injects a synthetic CANCEL into base OnTouchEvent; candidate 1 manually owns ScrollX/ScrollY and vetoes PerformClick. Candidate 2 uses native point reveal plus terminal touch-stream interception: no MovementMethod, synthetic event, ScrollTo/manual bounds, OnTouchListener, or PerformClick override.
Files Changed
src/Core/src/Platform/Android/PickerDragGestureFilter.cs(+159): active-pointer classifier, point reveal, and stream-consumption state.src/Core/src/Platform/Android/MauiPicker.cs(+14): native dispatch hook and post-init button semantics.src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs(+15): matching Material 3 behavior.src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt(+1):MauiPickerBase.DispatchTouchEventoverride.
Complete Captured Diff
diff --git a/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs b/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
index 367209bc0f..eae7cd6fb7 100644
--- a/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
+++ b/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
@@ -1,5 +1,6 @@
using Android.Content;
using Android.Text.Method;
+using Android.Views;
using AndroidX.Core.Graphics.Drawable;
using Google.Android.Material.TextField;
@@ -11,6 +12,10 @@ internal class MauiMaterialPicker : MauiMaterialPickerBase
public MauiMaterialPicker(Context context) : base(context)
{
PickerManager.Init(this);
+ Focusable = true;
+ FocusableInTouchMode = false;
+ Clickable = true;
+ LongClickable = false;
}
protected override void Dispose(bool disposing)
@@ -27,6 +32,8 @@ internal class MauiMaterialPicker : MauiMaterialPickerBase
// TODO: Material3 - make it public in .net 11
internal class MauiMaterialPickerBase : TextInputEditText
{
+ readonly PickerDragGestureFilter _dragGestureFilter = new();
+
public MauiMaterialPickerBase(Context context) : base(MauiMaterialContextThemeWrapper.Create(context))
{
if (Background is not null)
@@ -38,4 +45,12 @@ internal class MauiMaterialPickerBase : TextInputEditText
// MovementMethod handles cursor positioning, scrolling, and text selection (per Android docs).
// Since text is readonly, we disable it to avoid unnecessary cursor navigation during keyboard input.
protected override IMovementMethod? DefaultMovementMethod => null;
+
+ public override bool DispatchTouchEvent(MotionEvent? e)
+ {
+ if (_dragGestureFilter.ShouldConsumeTouch(this, e))
+ return true;
+
+ return base.DispatchTouchEvent(e);
+ }
}
diff --git a/src/Core/src/Platform/Android/MauiPicker.cs b/src/Core/src/Platform/Android/MauiPicker.cs
index 5a3e987934..fa885dba91 100644
--- a/src/Core/src/Platform/Android/MauiPicker.cs
+++ b/src/Core/src/Platform/Android/MauiPicker.cs
@@ -14,6 +14,10 @@ namespace Microsoft.Maui.Platform
public MauiPicker(Context context) : base(context)
{
PickerManager.Init(this);
+ Focusable = true;
+ FocusableInTouchMode = false;
+ Clickable = true;
+ LongClickable = false;
}
protected override void Dispose(bool disposing)
@@ -27,6 +31,8 @@ namespace Microsoft.Maui.Platform
public class MauiPickerBase : AppCompatEditText
{
+ readonly PickerDragGestureFilter _dragGestureFilter = new();
+
public MauiPickerBase(Context context) : base(context)
{
if (Background != null)
@@ -36,5 +42,13 @@ namespace Microsoft.Maui.Platform
// MovementMethod handles cursor positioning, scrolling, and text selection (per Android docs).
// Since text is readonly, we disable it to avoid unnecessary cursor navigation during keyboard input.
protected override IMovementMethod? DefaultMovementMethod => null;
+
+ public override bool DispatchTouchEvent(MotionEvent? e)
+ {
+ if (_dragGestureFilter.ShouldConsumeTouch(this, e))
+ return true;
+
+ return base.DispatchTouchEvent(e);
+ }
}
}
\ No newline at end of file
diff --git a/src/Core/src/Platform/Android/PickerDragGestureFilter.cs b/src/Core/src/Platform/Android/PickerDragGestureFilter.cs
new file mode 100644
index 0000000000..5cc2a484b9
--- /dev/null
+++ b/src/Core/src/Platform/Android/PickerDragGestureFilter.cs
@@ -0,0 +1,159 @@
+using Android.Views;
+using Android.Widget;
+using AView = Android.Views.View;
+
+namespace Microsoft.Maui.Platform;
+
+sealed class PickerDragGestureFilter
+{
+ int _touchSlop;
+ int _activePointerId = InvalidPointerId;
+ float _anchorX;
+ float _anchorY;
+ float _lastX;
+ bool _isDrag;
+ bool _consumeGesture;
+
+ const int InvalidPointerId = -1;
+
+ public bool ShouldConsumeTouch(TextView view, MotionEvent? e)
+ {
+ if (e is null)
+ return false;
+
+ var action = e.ActionMasked;
+
+ if (action == MotionEventActions.Down)
+ _consumeGesture = false;
+
+ RevealDraggedText(view, e);
+
+ var dragStarted = ShouldCancelClick(view, e);
+
+ if (dragStarted)
+ _consumeGesture = true;
+
+ var consume = _consumeGesture;
+
+ if (dragStarted)
+ {
+ view.CancelPendingInputEvents();
+ view.Pressed = false;
+ }
+
+ if (action == MotionEventActions.Up || action == MotionEventActions.Cancel)
+ _consumeGesture = false;
+
+ return consume;
+ }
+
+ public bool ShouldCancelClick(AView view, MotionEvent? e)
+ {
+ if (e is null)
+ return false;
+
+ switch (e.ActionMasked)
+ {
+ case MotionEventActions.Down:
+ var context = view.Context;
+ _touchSlop = context is null ? 0 : ViewConfiguration.Get(context)?.ScaledTouchSlop ?? 0;
+ _activePointerId = e.GetPointerId(0);
+ _anchorX = e.GetX(0);
+ _anchorY = e.GetY(0);
+ _lastX = _anchorX;
+ _isDrag = false;
+ return false;
+ case MotionEventActions.Move:
+ return TryClassifyDrag(e);
+ case MotionEventActions.PointerUp:
+ var cancelClick = TryClassifyDrag(e);
+ ReAnchor(e);
+ return cancelClick;
+ case MotionEventActions.Up:
+ cancelClick = TryClassifyDrag(e);
+ Reset();
+ return cancelClick;
+ case MotionEventActions.Cancel:
+ Reset();
+ return false;
+ }
+
+ return false;
+ }
+
+ void RevealDraggedText(TextView view, MotionEvent e)
+ {
+ if (_activePointerId == InvalidPointerId)
+ return;
+
+ var pointerIndex = e.FindPointerIndex(_activePointerId);
+
+ if (pointerIndex < 0)
+ return;
+
+ var x = e.GetX(pointerIndex);
+ var action = e.ActionMasked;
+
+ if (_isDrag && (action == MotionEventActions.Move || action == MotionEventActions.Up))
+ {
+ var deltaX = _lastX - x;
+ var layout = view.Layout;
+
+ if (deltaX != 0 && layout is not null && layout.LineCount > 0)
+ {
+ var availableWidth = view.Width - view.CompoundPaddingLeft - view.CompoundPaddingRight;
+
+ if (availableWidth > 0)
+ {
+ var targetX = deltaX > 0
+ ? view.ScrollX + availableWidth + deltaX
+ : view.ScrollX + deltaX;
+ var offset = layout.GetOffsetForHorizontal(0, targetX);
+ view.BringPointIntoView(offset);
+ }
+ }
+ }
+
+ _lastX = x;
+ }
+
+ bool TryClassifyDrag(MotionEvent e)
+ {
+ if (_isDrag || _activePointerId == InvalidPointerId)
+ return false;
+
+ var pointerIndex = e.FindPointerIndex(_activePointerId);
+
+ if (pointerIndex < 0)
+ return false;
+
+ var deltaX = global::System.Math.Abs(e.GetX(pointerIndex) - _anchorX);
+ var deltaY = global::System.Math.Abs(e.GetY(pointerIndex) - _anchorY);
+
+ if (global::System.Math.Max(deltaX, deltaY) <= _touchSlop)
+ return false;
+
+ _isDrag = true;
+ return true;
+ }
+
+ void ReAnchor(MotionEvent e)
+ {
+ var actionIndex = e.ActionIndex;
+
+ if (e.GetPointerId(actionIndex) != _activePointerId || e.PointerCount <= 1)
+ return;
+
+ var newPointerIndex = actionIndex == 0 ? 1 : 0;
+ _activePointerId = e.GetPointerId(newPointerIndex);
+ _anchorX = e.GetX(newPointerIndex);
+ _anchorY = e.GetY(newPointerIndex);
+ _lastX = _anchorX;
+ }
+
+ void Reset()
+ {
+ _activePointerId = InvalidPointerId;
+ _isDrag = false;
+ }
+}
diff --git a/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
index 01d355e5ff..00b3178d2a 100644
--- a/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
+++ b/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
@@ -25,3 +25,4 @@ override Microsoft.Maui.Platform.MauiSwipeRefreshLayout.OnInterceptTouchEvent(An
override Microsoft.Maui.Platform.MauiWebView.Dispose(bool disposing) -> void
override Microsoft.Maui.Platform.MauiWebView.OnDetachedFromWindow() -> void
override Microsoft.Maui.Platform.MauiWebView.OnTouchEvent(Android.Views.MotionEvent? e) -> bool
+override Microsoft.Maui.Platform.MauiPickerBase.DispatchTouchEvent(Android.Views.MotionEvent? e) -> boolTest Command and Results
Exact command (run once; the only test command used):
pwsh .github/skills/run-device-tests/scripts/Run-DeviceTests.ps1 -Project Core -Platform android -TestFilter "Category=Picker"
Outcome: Tests run: 121 Passed: 119 Inconclusive: 0 Failed: 0 Ignored: 2; XHarness exit code 0 (SUCCESS) on emulator-5554, Android API 30. No correction or retest was needed.
LongSelectedTextScrollsHorizontallyAndRemainsReadOnly: PASS (all 4 standard/Material × delayed-state cases)TapJitterClicksButFastSwipeDoesNot: PASSVerticalDragDoesNotClick: PASSCanceledDragDoesNotSuppressNextTap: PASSPointerReplacementWithoutMovementRemainsATap: PASSMovementMethodRemainsDisabled: PASS
Full output: CustomAgentLogsTmp/PRState/37232/PRAgent/try-fix/attempt-2/test-output.log
Expert Self-Review
findings_count: 0 — clean. The final diff was unchanged after testing. Inline review covered all overarching principles, always-active dimensions, and routed Performance, Public API, Threading, Memory, Android, Gestures, and Accessibility rules.
Analysis
The candidate passed because native point reveal supplies text scrolling without re-enabling cursor/selection machinery or manually computing viewport bounds. Consuming only classified drag streams prevents the base EditText from seeing a click-producing UP; ordinary taps remain native. Canceling pending input callbacks and clearing pressed state at classification handles delayed pressed state, while independent terminal resets prevent suppression from leaking to the next gesture. Active-pointer replacement is reanchored and UP-only movement is classified before dispatch.
Baseline
Established and restored exclusively through .github/scripts/EstablishBrokenBaseline.ps1; unrelated pre-existing worktree changes were preserved. Attempt artifacts: CustomAgentLogsTmp/PRState/37232/PRAgent/try-fix/attempt-2/.
🏁 Report — Final Recommendation
⚠️ Final Recommendation: REQUEST CHANGES
Winner: pr-plus-reviewer
The submitted PR has the strongest underlying design: it keeps MovementMethod null, delegates scrolling to Android's native ScrollingMovementMethod, and sends a targeted synthetic ACTION_CANCEL only to the base view when touch slop is crossed. pr-plus-reviewer preserves that proven behavior while restoring the invariant documentation and explicitly recycling synthesized MotionEvent instances.
Candidate comparison
| Rank | Candidate | Required Android Picker validation | Assessment |
|---|---|---|---|
| 1 | pr-plus-reviewer |
✅ 121 run, 119 passed, 2 ignored, 0 failed | Best balance of correctness and scope. It retains native text layout, alignment, RTL, pressed/prepressed cancellation, fast-swipe classification, and pointer tracking, with the two concrete reviewer improvements applied. |
| 2 | pr |
✅ Trusted Gate passed; all 13 new regression cases passed | Core mechanism is sound, but the synthesized event is not explicitly recycled and the reason DefaultMovementMethod must remain null was removed. |
| 3 | try-fix-2 |
✅ 121 run, 119 passed, 2 ignored, 0 failed | Native point reveal avoids manual bounds, but consuming the drag stream in DispatchTouchEvent and manually clearing pending/pressed state is more invasive than delivering a complete cancel to the base view. BringPointIntoView also changes scrolling from native drag handling to character-point reveal. |
| 4 | try-fix-1 |
✅ 121 run, 119 passed, 2 ignored, 0 failed | Manual ScrollTo bounds and a PerformClick veto pass the tests, but duplicate Android text-layout logic and a stale one-shot veto can suppress a later programmatic/accessibility click. |
No candidate failed the required regression tests, so the failure-priority rule does not alter the ranking.
Expert review reconciliation
The expert reviewer confirmed the PR's cancel-before-replay ordering, one-cancel latch, delayed pressed-state handling, ACTION_UP fast-swipe handling, active-pointer replacement, and lack of lifecycle leaks. Raw inline findings are in inline-findings.json.
The consolidated candidate applies the two findings that improve the submitted fix without widening behavior. Other suggestions are not winner requirements:
- The post-
PickerManager.Initfocus/click assignments are intentional:Initsets a null key listener after its initial assignments, and Android can reset those button semantics. - Expanding the behavior to DatePicker and TimePicker conflicts with this PR's selected-text Picker scope.
- A valid Android
Viewis constructed with a context, so the zero-slop fallback is defensive-path uncertainty rather than a demonstrated runtime defect. - Scrollable-parent interaction and stronger vertical-offset assertions remain coverage opportunities; the focused evidence does not establish a regression, and adding new gesture arbitration in this refinement would exceed the one-pass scope.
Recommendation
Apply pr-plus-reviewer/reviewer.patch to the submitted PR. The required test command passed once from the mandated candidate sandbox, and its build/test paths resolve to /home/vsts/work/_temp/pr-37232-pr-plus-reviewer.
📱 UI Tests — ViewBaseTests
Detected UI test categories: ViewBaseTests
✅ Deep UI tests — 118 passed, 0 failed, 1 skipped across 1 category on platform-pool agent (replaces in-process counts above).
🧪 UI Test Execution Results (deep, platform pool)
| Category | Tests | Snapshot diffs |
|---|---|---|
ViewBaseTests |
118/119 (1 skipped) ✓ | — |
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs) |
🧭 Next Steps — reviewer patch required (pr-plus-reviewer)
The reviewer-enhanced candidate won, so the submitted PR still needs those changes.
Why: The reviewer-enhanced PR preserves the submitted native scrolling and synthetic-cancel design while restoring its key invariant documentation and explicitly recycling synthesized MotionEvent instances. It passed all required Android Picker regressions and introduces less custom touch behavior than either try-fix alternative.
Apply PRAgent/pr-plus-reviewer/reviewer.patch from the CopilotLogs
artifact (or follow the report's Required submitted-PR change), push the update, and run
the review again.
|
/azp run |
|
Azure Pipelines: Successfully started running 3 pipeline(s). |
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
) <!-- 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! ### Root Cause #29068 set the Android Picker's default movement method to `null` to avoid editable `EditText` cursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally. ### Description of Change Restores horizontal drag scrolling for long selected `Picker` text on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views. The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native `ScrollingMovementMethod`. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed on `ACTION_UP`. When a gesture becomes a drag, the Picker platform view sends its base Android view an `ACTION_CANCEL`, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues. The filter tracks the active pointer and resets after `ACTION_UP` or `ACTION_CANCEL`. Long-click behavior is disabled only on the standard and Material Picker platform views after `PickerManager.Init`, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that share `PickerManager`. The hint-only `Title` case remains out of scope because Android renders the hint separately from selected text. ### Issues Fixed Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved. ### Alternative to #37067 #37067 implements manual gesture tracking and scrolling through an `OnTouchListener`. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling. ### What NOT to Do (for future agents) - Do not use `ArrowKeyMovementMethod`: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior. - Do not implement manual scrolling through an `OnTouchListener`: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling. - Do not clear only `View.Pressed` to suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled. - Do not classify only `ACTION_MOVE` or only the X delta: fast swipes may cross slop on `ACTION_UP`, and vertical movement must not open the dialog. - Do not treat the hint-only `Title` as selected text: Android lays it out separately and this movement method cannot scroll it. ### Tests - Android Core device tests, `Category=Picker`, on API 34: 121 run, 119 passed, 2 ignored, 0 failed. - Android Core device tests, `Category=Picker`, on API 35: 121 run, 119 passed, 2 ignored, 0 failed. - The Picker movement method remains `null`, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines. - The same expanded tests against the previous implementation produced 8 failures because the Picker became long-clickable. - With the long-click assertion removed to isolate touch behavior, the previous implementation still produced 4 failures: fast swipes and vertical drags opened both standard and Material Pickers. - Coverage includes normal taps, jitter below touch slop, horizontal and vertical drags, a fast swipe with no qualifying `MOVE`, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views. ### Evidence The original empirical comparison, including recordings and screenshots for `main`, #37067, `ArrowKeyMovementMethod`, and `ScrollingMovementMethod`, is in [this issue comment](#36834 (comment)). #### Initial recording This is the empirically validated `ScrollingMovementMethod` variant used as the basis for this PR. https://github.com/user-attachments/assets/068ec32b-84e5-496c-8e65-74ac23a422fa ---------
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
#29068 set the Android Picker's default movement method to
nullto avoid editableEditTextcursor behavior. That also disabled Android's built-in overflow-text scrolling, so long selected values could no longer be dragged horizontally.Description of Change
Restores horizontal drag scrolling for long selected
Pickertext on Android while keeping the control read-only and preserving normal tap behavior. This applies to both the standard and Material 3 Picker platform views.The implementation keeps the Picker's movement method disabled, preserving its existing text layout and D-pad focus navigation, and delegates only touch events to Android's native
ScrollingMovementMethod. A gesture filter classifies horizontal and vertical movement against Android's touch slop, including movement first observed onACTION_UP. When a gesture becomes a drag, the Picker platform view sends its base Android view anACTION_CANCEL, which clears pressed/prepressed state and pending tap/long-press callbacks before the real scroll event continues.The filter tracks the active pointer and resets after
ACTION_UPorACTION_CANCEL. Long-click behavior is disabled only on the standard and Material Picker platform views afterPickerManager.Init, avoiding behavior changes to DatePicker, TimePicker, and compatibility renderers that sharePickerManager.The hint-only
Titlecase remains out of scope because Android renders the hint separately from selected text.Issues Fixed
Addresses the selected-value scenario in #36834. This PR intentionally does not claim to close the issue while the hint-only scenario remains unresolved.
Alternative to #37067
#37067 implements manual gesture tracking and scrolling through an
OnTouchListener. This alternative keeps Android's native text-scrolling implementation, avoids occupying the view's single touch-listener slot, and only adds click suppression around native scrolling.What NOT to Do (for future agents)
ArrowKeyMovementMethod: empirical testing showed that it does not restore touch scrolling and reintroduces cursor-oriented behavior.OnTouchListener: it owns Android's single listener slot and requires custom alignment, RTL, and scroll-bound handling.View.Pressedto suppress the click: Android scrolling containers can use a prepressed state and pending callbacks, so the complete native touch state must be canceled.ACTION_MOVEor only the X delta: fast swipes may cross slop onACTION_UP, and vertical movement must not open the dialog.Titleas selected text: Android lays it out separately and this movement method cannot scroll it.Tests
Category=Picker, on API 34: 121 run, 119 passed, 2 ignored, 0 failed.Category=Picker, on API 35: 121 run, 119 passed, 2 ignored, 0 failed.null, preventing the RTL and horizontal-alignment visual regressions caught by UI-test baselines.MOVE, delayed child pressed state, canceled drag followed by a tap, active-pointer replacement, D-pad focus preservation, read-only properties, and standard/Material platform views.Evidence
The original empirical comparison, including recordings and screenshots for
main, #37067,ArrowKeyMovementMethod, andScrollingMovementMethod, is in this issue comment.Initial recording
This is the empirically validated
ScrollingMovementMethodvariant used as the basis for this PR.alt-b-scrollingmovementmethod-android-picker-scroll.mp4