Skip to content

Android: Fix horizontal scrolling for long selected Picker text - #37067

Closed
jpd21122012 wants to merge 2 commits into
dotnet:mainfrom
jpd21122012:fix/36834-PickerHorizontalScroll-Android
Closed

jpd21122012 wants to merge 2 commits into
dotnet:mainfrom
jpd21122012:fix/36834-PickerHorizontalScroll-Android

Conversation

@jpd21122012

Copy link
Copy Markdown
Contributor

Description of Change

This change restores horizontal scrolling for long selected text in the Android Picker, matching the behavior previously available in Xamarin.Forms.

The fix updates the native Android picker implementation to enable horizontal scrolling while preserving the existing tap behavior and read-only interaction model.

Validation

  • Added Android DeviceTests covering:
    • Horizontal scrolling of long selected text.
    • Tap behavior after horizontal scrolling.
    • Read-only behavior is preserved.
  • Manually validated using a standalone reproduction project.
  • Verified that:
    • Long selected text scrolls horizontally.
    • Normal tap interaction still opens the picker dialog.
    • No unintended dialog opening occurs while scrolling.
    • The control remains read-only.

Issue Fixed

Fixes #36834

I also validated the fix using a standalone reproduction project.

The original issue is no longer reproducible:

  • Horizontal scrolling works for long selected text.
  • Tap interaction continues to open the picker.
  • Read-only behavior is preserved.
  • No regressions were observed during manual testing.

Copilot AI review requested due to automatic review settings August 3, 2026 23:03
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37067

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37067"

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores horizontal scrolling for long selected text in the Android Picker by enabling horizontal scrolling on the underlying EditText and adding touch handling to distinguish horizontal drags from taps, while keeping the control read-only.

Changes:

  • Update Android PickerManager initialization to enable single-line/horizontal scrolling and add a touch listener that consumes horizontal drag gestures to scroll text without triggering a click.
  • Add Android device tests verifying long selected text can scroll horizontally and the picker remains read-only (with a small gap noted below).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/Core/src/Platform/Android/PickerManager.cs Enables horizontal scrolling and adds a touch listener to support horizontal drag scrolling without breaking tap behavior.
src/Core/tests/DeviceTests/Handlers/Picker/PickerHandlerTests.Android.cs Adds a device test for horizontal scrolling + read-only behavior (needs one extra assertion to cover “tap after scroll”).

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings August 3, 2026 23:26

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (3)

src/Core/src/Platform/Android/PickerManager.cs:191

  • This file already defines using AView = Android.Views.View; but the new touch listener uses View.IOnTouchListener / View? directly. MAUI Android platform code commonly uses AView aliases to avoid future View namespace collisions and to keep platform types explicit (e.g., src/Core/src/Platform/Android/MauiRippleDrawableExtensions.cs:10).
		sealed class PickerTouchListener : Java.Lang.Object, View.IOnTouchListener
		{
			float _startX;
			float _startY;
			float _lastX;
			bool _isHorizontalScrolling;

			public bool OnTouch(View? v, MotionEvent? e)
			{
				if (v is not EditText editText)
				{
					return false;
				}

				return OnTouchEvent(editText, e, ref _startX, ref _startY, ref _lastX, ref _isHorizontalScrolling);
			}

src/Core/src/Platform/Android/PickerManager.cs:112

  • ViewConfiguration.Get(context)?.ScaledTouchSlop ?? 0 falls back to 0 if Get returns null, which would treat essentially any horizontal movement as a scroll gesture and could suppress taps unexpectedly. Prefer using a non-zero default (or rely on ViewConfiguration.Get(context) being non-null) so the drag threshold stays meaningful.
						var context = editText.Context;

						if (context is null)
						{
							return false;
						}

						var touchSlop = ViewConfiguration.Get(context)?.ScaledTouchSlop ?? 0;

						if (totalX <= touchSlop || totalX <= totalY * DragDirectionRatio)
						{
							return false;
						}

src/Core/tests/DeviceTests/Handlers/Picker/PickerHandlerTests.Android.cs:140

  • The test subscribes to platformPicker.Click and unsubscribes only on the success path. If an assertion fails before the -= line, the handler remains subscribed until the view is GC’d, which can create noisy side effects across subsequent tests. Unsubscribe in a finally so it always runs.
					var clickCount = 0;
					platformPicker.Click += OnPickerClicked;

					DispatchTap(platformPicker);

					Assert.Equal(1, clickCount);

					platformPicker.ScrollTo(0, platformPicker.ScrollY);
					DispatchHorizontalDrag(platformPicker);

					Assert.True(platformPicker.ScrollX > 0, $"Expected Picker ScrollX to be greater than 0 after a horizontal drag, but it was {platformPicker.ScrollX}.");
					Assert.Equal(1, clickCount);

					DispatchTap(platformPicker);
					Assert.Equal(2, clickCount);
					platformPicker.Click -= OnPickerClicked;

					void OnPickerClicked(object sender, System.EventArgs e)
					{
						clickCount++;
					}
				}

@kubaflo

This comment has been minimized.

@github-actions github-actions Bot added the s/agent-review-in-progress AI review is currently running for this PR label Aug 5, 2026
@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Aug 5, 2026
@kubaflo

kubaflo commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).

@MauiBot MauiBot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI Review Summary

@jpd21122012 — new AI review results are available based on this last commit: 497c3bf.

Gate Inconclusive Confidence Low Platform Android


🗂️ Review Sessions — click to expand
🚦 Gate — Test Before & After Fix

Gate Result: ⚠️ INCONCLUSIVE

Platform: ANDROID · Base: main · Merge base: ad8249ec

🩺 Could not verify — the app under test crashed (APP_CRASH). The app SIGABRT'd / exited before the test produced a pass/fail, so the gate could not record a real result. The gate already retried on a rebooted device up to 3×; if it still reports this, the crash persisted across every attempt — a plain /review retry is unlikely to change it. This is not necessarily a problem with your PR, but it is also not a transient flake: the crash is either in the runtime/native libraries the test exercises or in the code under test. Download the adb-logcat / adb-bugreport from the drop-deep-uitests/gate artifact to see the native stack before retrying.

App crashed during test run (XHarness exit 80 APP_CRASH)

Test Without Fix (expect FAIL) With Fix (expect PASS)
📱 PickerHandlerTests (LongSelectedTextScrollsHorizontallyAndRemainsReadOnly) Category=Picker ⚠️ ENV ERROR ⚠️ ENV ERROR
🔴 Without fix — 📱 PickerHandlerTests (LongSelectedTextScrollsHorizontallyAndRemainsReadOnly): ⚠️ ENV ERROR · 1750s

(no coded error found; showing last 1200 chars)

re.devicetests'..
fail: Waiting for command timed out: execution may be compromised
fail: Error: Exit code: -2
      Std out:
info: Attempting to install /home/vsts/work/1/s/artifacts/bin/Core.DeviceTests/Debug/net10.0-android/com.microsoft.maui.core.devicetests-Signed.apk
fail: Error:
      Exit code: 1
      Std out:
      Serving...
      Performing Incremental Install
      cmd: Failure calling service package: Broken pipe (32)
      Performing Streamed Install
      Std err:
      All files should be loaded. Notifying the device.
      adb: failed to install /home/vsts/work/1/s/artifacts/bin/Core.DeviceTests/Debug/net10.0-android/com.microsoft.maui.core.devicetests-Signed.apk: cmd: Can't find service: package
crit: Install failure: Test command cannot continue
info: Attempting to remove apk 'com.microsoft.maui.core.devicetests'..
fail: Error: Exit code: 20
      Std out:
      Std err:
      cmd: Can't find service: package
info: Attempting to remove apk 'com.microsoft.maui.core.devicetests'..
fail: Error: Exit code: 20
      Std out:
      Std err:
      cmd: Can't find service: package
XHarness exit code: 78 (PACKAGE_INSTALLATION_FAILURE)
  Tests completed with exit code: 78
🟢 With fix — 📱 PickerHandlerTests (LongSelectedTextScrollsHorizontallyAndRemainsReadOnly): ⚠️ ENV ERROR · 891s

(no coded error found; showing last 1200 chars)

 crashed test (see log)
info: Wrote full ADB log (205 lines) to /home/vsts/work/1/s/artifacts/log/adb-logcat-com.microsoft.maui.core.devicetests-default.log
info: ADB log contained no DOTNET-tagged entries (see full log file for details)
info: Wrote ADB bugreport to /home/vsts/work/1/s/artifacts/log/adb-bugreport-com.microsoft.maui.core.devicetests.zip
info: <<XHARNESS_RESULT_START>>
      {
        "version": 1,
        "machineName": "runnervmtroe5",
        "exitCode": 80,
        "exitCodeName": "APP_CRASH",
        "platform": "android",
        "device": "emulator-5554",
        "deviceOsVersion": "API 30",
        "architecture": "x86_64",
        "files": [
          {
            "name": "adb-logcat-com.microsoft.maui.core.devicetests-default.log",
            "type": "logcat"
          },
          {
            "name": "adb-bugreport-com.microsoft.maui.core.devicetests.zip",
            "type": "bugreport"
          }
        ]
      }
      <<XHARNESS_RESULT_END>>
info: Attempting to remove apk 'com.microsoft.maui.core.devicetests'..
info: Successfully uninstalled com.microsoft.maui.core.devicetests
XHarness exit code: 80 (APP_CRASH)
  Tests completed with exit code: 80

⚠️ Failure Details

  • ⚠️ PickerHandlerTests (LongSelectedTextScrollsHorizontallyAndRemainsReadOnly) without fix: App crashed during test run (XHarness exit 80 APP_CRASH)
  • ⚠️ PickerHandlerTests (LongSelectedTextScrollsHorizontallyAndRemainsReadOnly) with fix: App crashed during test run (XHarness exit 80 APP_CRASH)
📁 Fix files reverted (1 files)
  • src/Core/src/Platform/Android/PickerManager.cs

📱 UI Tests — DatePicker,Gestures,Picker,TimePicker,ViewBaseTests

Detected UI test categories: DatePicker,Gestures,Picker,TimePicker,ViewBaseTests

✅ Deep UI tests — 305 passed, 0 failed across 5 categories on platform-pool agent (replaces in-process counts above).

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
DatePicker 44/44 ✓ —
Gestures 58/58 ✓ —
Picker 53/53 ✓ —
TimePicker 32/32 ✓ —
ViewBaseTests 118/119 ✓ —
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

📋 Pre-Flight — Context & Validation

Issue: #36834 - [Android] Can not scroll horizontally long text into Picker's title placeholder
PR: #37067 - Android: Fix horizontal scrolling for long selected Picker text
Platforms Affected: Android
Files Changed: 1 implementation, 1 test

Key Findings

  • The regression affects long Android Picker text; Xamarin.Forms allowed horizontal dragging, while MAUI's picker classes override DefaultMovementMethod to return null.
  • The issue discussion identifies ScrollingMovementMethod.Instance as a working mapper-based workaround.
  • The PR instead installs a custom IOnTouchListener, manually recognizes horizontal drags, clamps ScrollX, and adds Core DeviceTests for native and Material pickers.
  • The completed gate is inconclusive: both baseline and fixed runs were blocked by Android emulator/package-service crashes, so it provides no behavioral pass/fail evidence.
  • Independent review found concrete alignment/RTL range errors and a test synchronization error, plus gesture-listener lifecycle, pressed-state, and density-sensitive test risks.

Code Review Summary

Verdict: NEEDS_CHANGES
Confidence: low
Errors: 2 | Warnings: 3 | Suggestions: 3

Key code review findings:

  • ✗ PickerManager.cs:149 clamps to a zero-based range even when centered, end-aligned, or RTL text has a nonzero layout origin, which can make the text disappear on the first drag.
  • ✗ PickerHandlerTests.Android.cs:124 expects synchronous click delivery from DispatchTouchEvent, but Android posts PerformClick; the unattached view cannot satisfy the assertion in the same callback.
  • ⚠ PickerManager.cs:121 consumes move/up after allowing down through, bypassing Android's normal pressed-state cleanup.
  • ⚠ PickerManager.cs:47 installs a constructor-time touch listener into the same slot used by View.Touch, so gesture recognizers can permanently replace it.
  • ⚠ PickerHandlerTests.Android.cs:96 uses raw pixel geometry that can leave no scrollable width under high-density Material themes.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #37067 Custom IOnTouchListener with manual drag recognition and ScrollX clamping ⚠️ INCONCLUSIVE (Gate environment failure) PickerManager.cs, PickerHandlerTests.Android.cs Original PR

🔬 Code Review — Deep Analysis

Code Review — PR #37067

Independent Assessment

What this changes: PickerManager.Init (shared by MauiPicker, MauiDatePicker, MauiTimePicker, MauiMaterialPicker, MauiMaterialDatePicker, MauiMaterialTimePicker) now forces single-line/horizontal-scroll/non-selectable/non-long-clickable/no-cursor on the EditText, and installs a PickerTouchListener (IOnTouchListener) tracked in a static ConditionalWeakTable. The listener implements manual drag-to-scroll: past ScaledTouchSlop with totalX > totalY * 1.2, it latches, calls Parent.RequestDisallowInterceptTouchEvent(true), and ScrollTo(Clamp(ScrollX + Δ, 0, maxScroll)); it consumes ACTION_UP after a scroll so the dialog doesn't open.

Inferred motivation: Long selected picker text is clipped with no way to read it; XF allowed dragging the text.

Reconciliation with PR Narrative

Author claims: Restores XF horizontal scrolling; tap still opens the dialog; read-only preserved; covered by new Android device tests + manual validation on a repro project.

Agreement/disagreement: I agree with the goal and that the default (Start-aligned, LTR) case works. I disagree on two claims: (1) the validation claim — the new device tests cannot pass (below), and device tests did not run in CI, so "covered by tests" is unsubstantiated; (2) the fix is not alignment-safe — HorizontalTextAlignment="Center"/"End" and RTL text are broken by the new clamp. Manual validation on a default-aligned repro would not surface either. The PR body is also missing the mandatory "Are you waiting for the changes in this PR…" NOTE block required by repo contribution guidelines.

Prior Review Reconciliation

Prior ❌ Error Finding Source Status Evidence
(none) copilot-pull-request-reviewer[bot] (2 reviews), Copilot (2 inline) — All three surfaces queried untruncated (reviews / pulls-comments / issues-comments). No ❌, [major], or [critical] markers.
"Test never taps after the drag" (moderate) Copilot inline, PickerHandlerTests.Android.cs:131 ✅ Fixed Commit 2 added DispatchTap + Assert.Equal(2, clickCount) at lines 132–133
AView alias unused / View used directly (suggestion) Copilot inline, PickerManager.cs:192 ❌ Unresolved PickerManager.cs:170,176 still use bare View while line 8 declares using AView = …View
ScaledTouchSlop ?? 0 fallback; Click -= not in finally (suppressed) copilot bot ❌ Unresolved Still present at PickerManager.cs:104 and test line 134

No prior ❌ Error-level findings → Rule #5 override does not apply.

Blast Radius Assessment

Required — Android platform plumbing + touch/gesture handling, shared by six platform views.

  • Runs for all instances: Yes. Init is called from every picker platform view constructor; the listener is installed unconditionally, not gated on overflowing text (the scroll is gated, the listener is not).
  • Startup impact: No new startup path, but the Init changes execute during every picker construction.
  • Static/shared state: Yes — static readonly ConditionalWeakTable<EditText, PickerTouchListener> (PickerManager.cs:15). Weak-keyed with no back-reference to the EditText, so no leak; per-gesture state lives on the listener instance, so no cross-instance bleed.

CI Status

  • Required-check result: gh pr checks 37067 --required → exit 4, stderr To get started with GitHub CLI, please run: gh auth login → tool-unavailable per Step 5. Fell back to the public REST API for head SHA 497c3bf6: 31 check runs, 30 success / 1 skipped (Bump global.json), maui-pr green. Combined status: pending, total_count: 0; PR mergeable_state: unstable.
  • Classification: No PR-caused failures. Critical coverage gap: maui-pr-devicetests is absent from the check list — the new Android device test never executed, and maui-pr-uitests also did not run.
  • Action taken: Recorded the gh auth gap; did not invoke azdo-build-investigator (no failures to classify); capped confidence at low for both the tool gap and the "no relevant tests run" evidence row.

Findings

❌ Error — [0, maxScroll] clamp is wrong for Center/End alignment and RTL, and blanks the text

PickerManager.cs:149 (ScrollHorizontally) / :157 (GetMaxHorizontalScroll).

Init sets SetHorizontallyScrolling(true) (:21), so TextView.onMeasure/assumeLayout build the Layout with want = VERY_WIDE (1 048 576), not the view width. Layout.getLineLeft(0) is therefore 0 only for ALIGN_NORMAL + LTR. MAUI maps Picker.HorizontalTextAlignment to gravity in TextAlignmentExtensions.cs:17 (Center → CenterHorizontal, End → End), and TextView.setGravity calls makeNewLayout(…, bringIntoView: true) → onPreDraw() → bringTextIntoView() (reached because mMovement is null — see MauiPickerBase.DefaultMovementMethod => null). For overflowing text that sets mScrollX to ≈524 288 (ALIGN_CENTER) or ≈1 048 576 − hspace (ALIGN_RIGHT / RTL ALIGN_NORMAL).

GetMaxHorizontalScroll returns ceil(lineWidth) − availableWidth — a few hundred px. So on the first ACTION_MOVE, Math.Clamp(524288 + Δ, 0, ~300) snaps ScrollX from ~524 k to ~300, and ScrollTo moves the content ~524 000 px out of view: the picker goes blank and cannot be recovered by dragging (the clamp range is disjoint from the valid range). This hits every HorizontalTextAlignment="Center" / "End" picker and every RTL-script picker with overflowing text, and it is a regression from today's behavior where the text is at least visible. The scroll range must be expressed relative to layout.GetLineLeft(0) (e.g. [floor(getLineLeft(0)), ceil(getLineRight(0)) − availableWidth]), not [0, max].

❌ Error — The new device test cannot pass: View posts PerformClick instead of invoking it

PickerHandlerTests.Android.cs:124, :130, :133.

View.onTouchEvent's ACTION_UP path does if (!post(mPerformClick)) { performClickInternal(); }, and View.post returns true when mAttachInfo == null (it queues into getRunQueue() and defers to attach). CreateNativePicker + LayoutNativePicker (:158–186) construct and manually Measure/Layout the picker but never attach it to a window, and the whole body runs inside a single InvokeOnMainThreadAsync lambda, so no posted runnable can execute before the assertions. clickCount is therefore 0 at line 124 → Assert.Equal(1, clickCount) fails. Attaching the view would not fix it either — attachInfo.mHandler.post(...) also returns true and runs the click asynchronously.

Corroboration: this is the only DispatchTouchEvent-based test in the repo. Every other Android device test that verifies clicks calls PerformClick() directly (ButtonHandlerTests.Android.cs:214, ImageButtonHandlerTests.Android.cs:32, CheckBoxHandlerTests.Android.cs:67, EntryHandlerTests.Android.cs:416). Because maui-pr-devicetests did not run, CI did not catch this — so the PR's central validation claim is currently unverified.

⚠️ Warning — Picker stays stuck in the pressed/ripple state after a drag

PickerManager.cs:121 (returns true on MOVE) and :133 (returns true on UP).

When an IOnTouchListener returns true, View.dispatchTouchEvent skips onTouchEvent entirely. All press-state teardown lives there: removeTapCallback(), setPressed(false), mUnsetPressedState. ACTION_DOWN returns false (:88), so onTouchEvent does run and either calls setPressed(true, x, y) immediately (no scrolling ancestor) or posts mPendingCheckForTap (inside a ScrollView/CollectionView). Once the drag latches, onTouchEvent never sees MOVE, UP, or CANCEL, so nothing ever clears it — inside a scrolling container the press highlight even appears ~100 ms after the finger lifts. The picker stays visually pressed until the next unrelated tap. Call editText.Pressed = false (or CancelPendingInputEvents()) at the moment isHorizontalScrolling latches (:112).

⚠️ Warning — Touch listener is installed in the constructor, not ConnectHandler, and collides with View.Touch

PickerManager.cs:47 (SetTouchListener), reached from every picker platform view constructor.

In .NET for Android, View.Touch is generated over SetOnTouchListener, so it and SetOnTouchListener are the same single slot. GesturePlatformManager.Android.cs:241 does platformView.Touch += OnPlatformViewTouched whenever the Picker has any non-pointer gesture recognizer, which replaces PickerTouchListener; :222/:295/:312 then do Touch -=, which nulls the slot when the last handler is removed. Because Init only runs in the constructor (unlike ButtonHandler.Android.cs:43–49/60–66, which installs in ConnectHandler and removes in DisconnectHandler), the picker's scroll listener is permanently lost — handler reconnect after a Shell tab switch or navigation will not restore it. Moving install/remove into the picker handlers' ConnectHandler/DisconnectHandler matches the established MAUI pattern and makes the lifecycle symmetric (note MauiDatePicker, MauiTimePicker, MauiMaterialDatePicker, MauiMaterialTimePicker call Init but never PickerManager.Dispose).

⚠️ Warning — Test geometry is raw pixels and will be density/theme dependent

PickerHandlerTests.Android.cs:96, :170–177.

pickerWidth = 96 is a raw pixel MeasureSpec.Exactly, but GetMaxHorizontalScroll computes Width − TotalPaddingLeft − TotalPaddingRight. On xxhdpi/xxxhdpi with the Material TextInputEditText theme (MauiMaterialContextThemeWrapper), compound padding can approach or exceed 96 px, making availableWidth <= 0 → maxScroll == 0 → CanScrollHorizontally false → Assert.True(ScrollX > 0) (:129) fails on some Helix queues and passes on others. Size in dp via Context.ToPixels(...), or assert relative to the measured padding.

💡 Suggestion — Redundant/dead calls in Init, one with a latent ordering hazard

PickerManager.cs:21–23. SetHorizontallyScrolling(true) and SetSingleLine(true) are already implied by the pre-existing InputType = InputTypes.Null (TextView.setInputType → applySingleLine(true, …)), so they change nothing. SetTextIsSelectable(false) is a no-op — TextView.setTextIsSelectable early-returns on mEditor.mTextIsSelectable == selectable, and mTextIsSelectable defaults to false. If it ever weren't a no-op it would call setClickable(false) + setFocusableInTouchMode(false) + setMovementMethod(null), undoing Clickable = true set two lines earlier at :20 and breaking tap-to-open. Consider dropping all three. Correspondingly, Assert.False(platformPicker.IsTextSelectable) (:179) is vacuous — it passes on unpatched code.

💡 Suggestion — Delta fidelity at drag start and on slow drags

PickerManager.cs:118–120. lastX is initialized at ACTION_DOWN and never reset when the latch trips, so the first scrolled MOVE applies the entire pre-slop displacement — the text jumps by ≥ ScaledTouchSlop the instant scrolling begins. Reset lastX = currentX at :112 right after latching. Separately, (int)Math.Round(deltaX) discards sub-pixel deltas without accumulating them, so very slow drags scroll erratically; keep a float accumulator.

💡 Suggestion — Unaddressed prior-review items

ViewConfiguration.Get(context)?.ScaledTouchSlop ?? 0 (:104) makes any horizontal movement a scroll if Get returns null — prefer a sane non-zero default. platformPicker.Click -= OnPickerClicked (test :134) should be in the existing finally. And per the bot's still-open inline comment, use the file's AView alias at :170/:176 instead of bare View.

External Output Contract

Not applicable — the change classifies MotionEvent actions from the Android framework, not external tool text output. The equivalent producer/consumer trace is covered by the ❌ alignment finding: the producer is TextView.bringTextIntoView()/Layout.getLineLeft(0) (which emits ScrollX ≈ VERY_WIDE-relative values under ALIGN_CENTER/ALIGN_RIGHT/RTL), while the consumer (ScrollHorizontally) assumes a 0-based origin. Ordinary negative case: a Center-aligned picker with a long item — it reaches the restrictive path and the text is scrolled out of view.

Failure-Mode Probing

  • Does the code run on pickers that don't overflow? Yes — the listener is installed on all six platform view types. CanScrollHorizontally returns false early, onTouchEvent sees every event, and taps work. Safe.
  • Latch trace (isHorizontalScrolling) — every set/clear path: Set only at :112. Cleared at :76 (!CanScrollHorizontally early return), :87 (DOWN), :129 (UP/CANCEL). State is per-listener instance on the UI thread, so no cross-gesture or cross-instance bleed. However, the guard suppresses more than local work: the true return at :121/:133 also bypasses View.onTouchEvent's press-state teardown — the downstream effect that is never re-run. That is the un-disproven failure mode in the ⚠️ stuck-press finding, and I could not trace any path that clears PFLAG_PRESSED within the same gesture.
  • Text becomes non-scrollable mid-gesture (e.g. SelectedIndex changes): :74 fires on the next event, resets the latch, and returns false. If that next event is the UP, View.onTouchEvent runs and opens the picker dialog at the end of a drag. Narrow, but real.
  • Handler disconnect/reconnect (Shell tab switch, navigation): The listener is never reinstalled — Init is constructor-only. Combined with GesturePlatformManager's Touch -= nulling the slot, drag-to-scroll can be silently and permanently disabled. See ⚠️ above.
  • Null Parent / PlatformView / Context: All null-guarded (:79, :113, :96–100). Fine.
  • Accumulating subscriptions across lifecycle: No — SetTouchListener calls RemoveTouchListener first, and ConditionalWeakTable.Add cannot throw on duplicate because every ctor path calls Initialize() exactly once and the (IntPtr, JniHandleOwnership) ctors don't call it at all.
  • Static state going stale: No — weak key, no back-reference to the EditText; GC bridge handles the JNI global ref for the four types that never call Dispose.
  • Accessibility: TalkBack activation still works (performClick via the a11y action path). The new scroll affordance is touch-only with no AccessibilityAction, so the overflowing text remains unreachable for TalkBack/keyboard users — the original issue is only half solved.

Verdict: NEEDS_CHANGES

Confidence: low (Step 6: platform handler/UI plumbing caps at medium; the "no relevant tests run" evidence row and the gh-unavailable CI gap each cap at low; most restrictive applies. Note this is confidence in the merge-safety recommendation — my confidence that the two ❌ mechanisms exist is high.)

Summary: The default Start-aligned LTR case works and the approach is reasonable, but the [0, maxScroll] clamp ignores that SetHorizontallyScrolling(true) makes the Layout VERY_WIDE-based, so Center/End-aligned and RTL pickers start at ScrollX ≈ 500 k–1 M and the first drag scrolls their text completely out of view — a regression on a frequently-regressed control family. Separately, the new device test's click assertions cannot pass because View posts PerformClick rather than invoking it on an unattached view, and maui-pr-devicetests never ran, so the PR's validation claim is unverified. Fix the scroll range relative to Layout.GetLineLeft(0), rework the test to follow the repo's PerformClick() pattern with dp-based sizing, clear the press state when the drag latches, and move listener install/removal into ConnectHandler/DisconnectHandler.


🛠️ Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 claude-opus-5 + MAUI expert review Restore Android's ScrollingMovementMethod path, use AOSP touch/slop/alignment clamping, and suppress only the posted click after an actual scroll ✅ PASS — 112/112 executed Picker tests; 6/6 new negative-control failures without the fix 9 files Eliminates the PR's touch-listener collision and zero-based clamp; self-review recorded 1 moderate and 2 minor follow-ups
PR PR #37067 Constructor-installed IOnTouchListener with manual drag recognition and zero-based ScrollX clamping ⚠️ INCONCLUSIVE (Gate environment failure) 2 files Independent review found Center/End/RTL blanking, pressed-state/lifecycle risks, and a test that assumes synchronous click delivery

Cross-Pollination

Model Round New Ideas? Details
claude-opus-5 1 Yes Identified the null movement method as the root cause and delegated scrolling/clamping to Android's existing Touch implementation
gpt-5.6-sol 2 Not run Candidate #1 met the requested pass-and-better stop criterion; the Phase 2 time budget was also exhausted

Exhausted: No
Selected Fix: Candidate #1 — it passed the full Android Picker category, its six focused regressions failed under a one-line negative control, and it removes the PR's critical alignment/RTL and touch-listener failure modes. Detailed diff, test output, negative control, and residual expert findings are preserved in try-fix-1/content.md and try-fix/attempt-1/.


📝 Recommended PR Title & Description

Assessment: ✏️ Recommend updating — the winning fix replaces the PR's manual touch handling with ScrollingMovementMethod, affects six Android picker platform views, and adds alignment/RTL validation that the current metadata does not describe.

Recommended title

[Android] Picker: Restore horizontal drag scrolling for long selected text

Recommended description

## Description of Change

This change restores horizontal drag scrolling for long selected text in the Android `Picker`, matching the behavior previously available in Xamarin.Forms while preserving tap-to-open and read-only interaction.

### Root Cause

The Android picker platform views override `DefaultMovementMethod` with `null`. Although `InputTypes.Null` already configures the text as a single horizontally scrollable line, removing the movement method also removes Android's touch-scrolling path.

### Fix

- `PickerManager` installs a read-only `PickerMovementMethod : ScrollingMovementMethod`, delegating touch slop, drag handling, and alignment/RTL-aware scroll clamping to Android's existing `Touch` implementation.
- The movement method anchors selection when text changes so a newly selected item is brought back into its valid scroll range.
- `MauiPickerBase`, `MauiDatePicker`, `MauiTimePicker`, and their Material variants suppress only the `PerformClick()` posted after a drag that actually scrolled; normal taps still open the picker dialog.
- Read-only behavior is preserved: keyboard editing, cursor display, text selection, and long-click editing remain disabled.
- Android public API entries are added for the new public `PerformClick()` overrides.

### Platform Notes

This is Android-only. `PickerManager` is shared by the standard and Material Picker, DatePicker, and TimePicker platform views, so all six use the same read-only movement and click-suppression behavior.

### Validation

- Android Core DeviceTests `Category=Picker`: 112/112 selected tests passed.
- Added coverage for:
  - Standard and Material pickers.
  - Horizontal dragging without opening the picker dialog.
  - Tap behavior before and after scrolling.
  - Read-only and pressed-state behavior.
  - Scroll reset after changing the selected item.
  - Start, Center, and End text alignment.
  - Right-to-left text and layout direction.
- Negative control: removing only the movement-method assignment caused exactly the six new regression cases to fail while existing Picker tests continued to pass.

### Issues Fixed

Fixes #36834

🏁 Report — Final Recommendation

Comparative Report — PR #37067

The gate result is INCONCLUSIVE, not a regression failure: both baseline and PR runs were blocked by Android emulator/package-service crashes. STEP 5a produced one alternative candidate, try-fix-1.

Ranking

Rank Candidate Evidence Assessment
1 try-fix-1 ✅ 112/112 Android Picker tests passed; all 6 new cases failed under the one-line negative control Restores Android's existing ScrollingMovementMethod path, including touch slop and alignment/RTL-aware clamping. Avoids the PR's listener-slot collision and pressed-state bypass.
2 pr-plus-reviewer ✅ Android Core and Core DeviceTests builds; runtime tests not run Repairs the expert findings while retaining a picker-scoped manual recognizer. Safer than the PR, but larger and less empirically verified than try-fix-1.
3 pr ⚠️ Gate inconclusive Contains verified Center/End/RTL blanking, stale scroll offsets, listener lifecycle conflicts, pressed-state cleanup loss, and a click test that cannot observe Android's posted click.

Candidate comparison

pr

The raw PR solves only the default Start-aligned LTR case reliably. Its zero-based clamp conflicts with Android's very-wide text layout, and its constructor-installed touch listener is both shared with DatePicker/TimePicker and replaceable by MAUI gesture subscriptions. The added test does not attach the view or wait for PerformClick, so it cannot substantiate the tap-preservation claim.

pr-plus-reviewer

This candidate applies the expert feedback directly: true layout bounds, text-change reset, native event cleanup, picker-only scope, non-conflicting OnTouchEvent overrides, density-independent attached tests, and lower hot-path overhead. It compiles cleanly, but it still hand-rolls gesture behavior and lacks a device execution or a negative-control run.

try-fix-1

This candidate addresses the root cause instead of extending the manual listener: the picker classes disable DefaultMovementMethod, so it installs a read-only PickerMovementMethod : ScrollingMovementMethod and delegates drag behavior to Android's existing Touch implementation. PerformClick suppression prevents a completed scroll from opening the dialog while preserving Android's normal pressed/accessibility path.

Its tests cover native and Material pickers, tap-before-drag, drag-without-click, pressed-state cleanup, tap-after-drag, selected-item reset, Start/Center/End alignment, and RTL. The full Picker category passed, and removing only the movement-method assignment caused exactly the six new cases to fail.

Residual risks are smaller and explicit: DatePicker/TimePicker share the new click-suppression path without category-specific coverage, and a drag ending outside the view can leave _dragScrolled set until the next touch or click. These should be follow-up hardening, but they do not outweigh the candidate's simpler platform-native design and direct regression evidence.

Winner

try-fix-1 is the single winning candidate. It is the only option with passing runtime regression evidence and a discriminating negative control, while also eliminating the raw PR's verified alignment, lifecycle, and pressed-state defects.


🧭 Next Steps — alternative fix proposed (try-fix-1)

Automated review — alternative fix proposed

The expert-reviewer evaluation compared the PR fix against automatically generated candidates and selected try-fix-1 as the strongest fix.

Why: try-fix-1 is the only candidate with passing Android Picker regression evidence (112/112 tests plus six discriminating negative controls), and it restores Android's alignment/RTL-aware scrolling path instead of maintaining a conflicting manual touch listener. Its remaining DatePicker/TimePicker coverage and click-latch risks are smaller than the verified defects or unverified complexity in the other candidates.

Please consider applying the candidate diff below (or use it as guidance). Once you push an update, this workflow will re-trigger and re-evaluate.

Candidate diff (try-fix-1)
diff --git a/src/Core/src/Platform/Android/Material3Controls/MauiMaterialDatePicker.cs b/src/Core/src/Platform/Android/Material3Controls/MauiMaterialDatePicker.cs
index d330cfa574..8b2dd61e94 100644
--- a/src/Core/src/Platform/Android/Material3Controls/MauiMaterialDatePicker.cs
+++ b/src/Core/src/Platform/Android/Material3Controls/MauiMaterialDatePicker.cs
@@ -34,12 +34,24 @@ internal class MauiMaterialDatePicker : TextInputEditText, IOnClickListener
     }
 
     // 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.
+    // Since text is readonly, the editing one is disabled here; PickerManager installs a read-only
+    // scrolling movement method instead so long text can still be dragged into view.
     protected override IMovementMethod? DefaultMovementMethod => null;
 
     public Action? ShowPicker { get; set; }
     public Action? HidePicker { get; set; }
 
+    public override bool PerformClick()
+    {
+        // A drag that scrolled the text is not a tap, so it must not open the picker.
+        if (PickerManager.ShouldSuppressClick(this))
+        {
+            return false;
+        }
+
+        return base.PerformClick();
+    }
+
     public void OnClick(View? v)
     {
         ShowPicker?.Invoke();
diff --git a/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs b/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
index 367209bc0f..49777ce33b 100644
--- a/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
+++ b/src/Core/src/Platform/Android/Material3Controls/MauiMaterialPicker.cs
@@ -36,6 +36,18 @@ 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.
+	// Since text is readonly, the editing one is disabled here; PickerManager installs a read-only
+	// scrolling movement method instead so long text can still be dragged into view.
 	protected override IMovementMethod? DefaultMovementMethod => null;
+
+	public override bool PerformClick()
+	{
+		// A drag that scrolled the text is not a tap, so it must not open the picker.
+		if (PickerManager.ShouldSuppressClick(this))
+		{
+			return false;
+		}
+
+		return base.PerformClick();
+	}
 }
diff --git a/src/Core/src/Platform/Android/MauiDatePicker.cs b/src/Core/src/Platform/Android/MauiDatePicker.cs
index 77d1c46ec8..6524340c11 100644
--- a/src/Core/src/Platform/Android/MauiDatePicker.cs
+++ b/src/Core/src/Platform/Android/MauiDatePicker.cs
@@ -33,12 +33,22 @@ 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.
+		// Since text is readonly, the editing one is disabled here; PickerManager installs a read-only
+		// scrolling movement method instead so long text can still be dragged into view.
 		protected override IMovementMethod? DefaultMovementMethod => null;
 
 		public Action? ShowPicker { get; set; }
 		public Action? HidePicker { get; set; }
 
+		public override bool PerformClick()
+		{
+			// A drag that scrolled the text is not a tap, so it must not open the picker.
+			if (PickerManager.ShouldSuppressClick(this))
+				return false;
+
+			return base.PerformClick();
+		}
+
 		public void OnClick(View? v)
 		{
 			ShowPicker?.Invoke();
diff --git a/src/Core/src/Platform/Android/MauiMaterialTimePicker.cs b/src/Core/src/Platform/Android/MauiMaterialTimePicker.cs
index 315a0b2a38..116fc495ed 100644
--- a/src/Core/src/Platform/Android/MauiMaterialTimePicker.cs
+++ b/src/Core/src/Platform/Android/MauiMaterialTimePicker.cs
@@ -33,12 +33,24 @@ internal class MauiMaterialTimePicker : TextInputEditText, IOnClickListener
     }
 
     // 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.
+    // Since text is readonly, the editing one is disabled here; PickerManager installs a read-only
+    // scrolling movement method instead so long text can still be dragged into view.
     protected override IMovementMethod? DefaultMovementMethod => null;
 
     public Action? ShowPicker { get; set; }
     public Action? HidePicker { get; set; }
 
+    public override bool PerformClick()
+    {
+        // A drag that scrolled the text is not a tap, so it must not open the picker.
+        if (PickerManager.ShouldSuppressClick(this))
+        {
+            return false;
+        }
+
+        return base.PerformClick();
+    }
+
     public void OnClick(View? v)
     {
         ShowPicker?.Invoke();
diff --git a/src/Core/src/Platform/Android/MauiPicker.cs b/src/Core/src/Platform/Android/MauiPicker.cs
index 5a3e987934..f5f6cf3aa1 100644
--- a/src/Core/src/Platform/Android/MauiPicker.cs
+++ b/src/Core/src/Platform/Android/MauiPicker.cs
@@ -34,7 +34,17 @@ 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.
+		// Since text is readonly, the editing one is disabled here; PickerManager installs a read-only
+		// scrolling movement method instead so long text can still be dragged into view.
 		protected override IMovementMethod? DefaultMovementMethod => null;
+
+		public override bool PerformClick()
+		{
+			// A drag that scrolled the text is not a tap, so it must not open the picker.
+			if (PickerManager.ShouldSuppressClick(this))
+				return false;
+
+			return base.PerformClick();
+		}
 	}
 }
\ No newline at end of file
diff --git a/src/Core/src/Platform/Android/MauiTimePicker.cs b/src/Core/src/Platform/Android/MauiTimePicker.cs
index 7323bab088..eeb6b5737d 100644
--- a/src/Core/src/Platform/Android/MauiTimePicker.cs
+++ b/src/Core/src/Platform/Android/MauiTimePicker.cs
@@ -33,12 +33,22 @@ 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.
+		// Since text is readonly, the editing one is disabled here; PickerManager installs a read-only
+		// scrolling movement method instead so long text can still be dragged into view.
 		protected override IMovementMethod? DefaultMovementMethod => null;
 
 		public Action? ShowPicker { get; set; }
 		public Action? HidePicker { get; set; }
 
+		public override bool PerformClick()
+		{
+			// A drag that scrolled the text is not a tap, so it must not open the picker.
+			if (PickerManager.ShouldSuppressClick(this))
+				return false;
+
+			return base.PerformClick();
+		}
+
 		public void OnClick(View? v)
 		{
 			ShowPicker?.Invoke();
diff --git a/src/Core/src/Platform/Android/PickerManager.cs b/src/Core/src/Platform/Android/PickerManager.cs
index 29ec7c498c..9f420deee0 100644
--- a/src/Core/src/Platform/Android/PickerManager.cs
+++ b/src/Core/src/Platform/Android/PickerManager.cs
@@ -1,6 +1,7 @@
 using System;
 using System.Collections.Generic;
 using Android.Text;
+using Android.Text.Method;
 using Android.Text.Style;
 using Android.Views;
 using Android.Widget;
@@ -20,11 +21,81 @@ namespace Microsoft.Maui.Platform
 			// InputType needs to be set before setting KeyListener
 			editText.InputType = InputTypes.Null;
 			editText.KeyListener = null;
+
+			// A selected item can be wider than the picker, so the text has to live on a single scrollable
+			// line that can be dragged, like it could in Xamarin.Forms. Android already knows how to drag a
+			// TextView's text around: touch slop, drag direction and alignment/RTL aware clamping all live in
+			// Android.Text.Method.Touch, which is what ScrollingMovementMethod drives.
+			editText.SetHorizontallyScrolling(true);
+			editText.MovementMethod = new PickerMovementMethod();
+
+			// Both the KeyListener and the MovementMethod setters run TextView.fixFocusableAndClickableSettings(),
+			// which turns focusable/clickable/long clickable back on, so the read-only flags have to be
+			// (re)applied after them.
+			editText.Focusable = true;
+			editText.FocusableInTouchMode = false;
+			editText.Clickable = true;
+			editText.LongClickable = false;
+			editText.SetCursorVisible(false);
 		}
 
 		public static void Dispose(EditText editText)
 		{
 			editText.SetOnClickListener(null);
 		}
+
+		// True when the click Android is about to deliver is the tail of a drag that actually scrolled the
+		// text; dragging the selected item into view must not open the picker.
+		public static bool ShouldSuppressClick(EditText editText) =>
+			editText.MovementMethod is PickerMovementMethod movementMethod && movementMethod.ConsumeDragScroll();
+
+		// Read-only variant of ScrollingMovementMethod: it keeps the drag scrolling that Touch provides, but
+		// leaves key handling to the picker itself.
+		sealed class PickerMovementMethod : ScrollingMovementMethod
+		{
+			bool _dragScrolled;
+
+			public bool ConsumeDragScroll()
+			{
+				var dragScrolled = _dragScrolled;
+				_dragScrolled = false;
+				return dragScrolled;
+			}
+
+			// BaseMovementMethod.initialize does not select anything, and TextView.onPreDraw() only normalizes
+			// the scroll offset when there is a selection to bring into view. Without this anchor, Center/End
+			// and RTL text (laid out inside a very wide layout) would rest off screen. Text updates re-run this,
+			// which is also what resets the scroll offset when a new item is selected.
+			public override void Initialize(TextView? widget, ISpannable? text)
+			{
+				base.Initialize(widget, text);
+
+				if (text is not null)
+					Selection.SetSelection(text, 0);
+			}
+
+			public override bool OnTouchEvent(TextView? widget, ISpannable? text, MotionEvent? e)
+			{
+				if (widget is null || text is null || e is null)
+					return false;
+
+				var scrollX = widget.ScrollX;
+				var handled = base.OnTouchEvent(widget, text, e);
+
+				if (e.ActionMasked == MotionEventActions.Down)
+					_dragScrolled = false;
+				else if (e.ActionMasked == MotionEventActions.Move && widget.ScrollX != scrollX)
+					_dragScrolled = true;
+
+				return handled;
+			}
+
+			// Scrolling the text with the D-pad would swallow the arrow keys that move focus between controls.
+			public override bool OnKeyDown(TextView? widget, ISpannable? text, Keycode keyCode, KeyEvent? e) =>
+				false;
+
+			public override bool OnKeyOther(TextView? widget, ISpannable? text, KeyEvent? e) =>
+				false;
+		}
 	}
-}
\ No newline at end of file
+}
diff --git a/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt b/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
index 01d355e5ff..61b53e68d5 100644
--- a/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
+++ b/src/Core/src/PublicAPI/net-android/PublicAPI.Unshipped.txt
@@ -25,3 +25,6 @@ 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.MauiDatePicker.PerformClick() -> bool
+override Microsoft.Maui.Platform.MauiPickerBase.PerformClick() -> bool
+override Microsoft.Maui.Platform.MauiTimePicker.PerformClick() -> bool
diff --git a/src/Core/tests/DeviceTests/Handlers/Picker/PickerHandlerTests.Android.cs b/src/Core/tests/DeviceTests/Handlers/Picker/PickerHandlerTests.Android.cs
index 6b472900d5..f92ff4fc3c 100644
--- a/src/Core/tests/DeviceTests/Handlers/Picker/PickerHandlerTests.Android.cs
+++ b/src/Core/tests/DeviceTests/Handlers/Picker/PickerHandlerTests.Android.cs
@@ -1,12 +1,21 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Threading.Tasks;
+using Android.OS;
+using Android.Text;
 using Android.Views;
+using Android.Widget;
+using AndroidX.AppCompat.Widget;
 using Microsoft.Maui.DeviceTests.Stubs;
 using Microsoft.Maui.Graphics;
 using Microsoft.Maui.Handlers;
 using Xunit;
+using static Microsoft.Maui.DeviceTests.AssertHelpers;
 using AColor = Android.Graphics.Color;
+using ALayoutDirection = Android.Views.LayoutDirection;
 using ATextAlignment = Android.Views.TextAlignment;
+using ATextDirection = Android.Views.TextDirection;
+using AView = Android.Views.View;
 
 namespace Microsoft.Maui.DeviceTests
 {
@@ -85,9 +94,275 @@ namespace Microsoft.Maui.DeviceTests
 			Assert.Equal(expectedValue, values.PlatformViewValue, EmCoefficientPrecision);
 		}
 
+		[Theory(DisplayName = "Long Selected Text Can Be Dragged Horizontally Without Opening The Picker")]
+		[InlineData(false)]
+		[InlineData(true)]
+		public async Task LongSelectedTextDragScrollsWithoutOpeningPicker(bool useMaterialPicker)
+		{
+			await InvokeOnMainThreadAsync(async () =>
+			{
+				var platformPicker = CreatePlatformPicker(useMaterialPicker, LongItem);
+				var container = CreatePickerContainer(platformPicker);
+
+				try
+				{
+					await container.AttachAndRun(async () =>
+					{
+						AssertReadOnlyPicker(platformPicker);
+						Assert.Equal(LongItem, platformPicker.Text);
+
+						await AssertEventually(
+							() => IsRestingInsideScrollRange(platformPicker),
+							message: "Timed out waiting for the long selected item to settle inside its scrollable range.");
+
+						var (minScrollX, maxScrollX) = GetScrollRange(platformPicker);
+						var restingScrollX = platformPicker.ScrollX;
+						var clicks = 0;
+
+						void OnPickerClicked(object sender, EventArgs e) => clicks++;
+
+						platformPicker.Click += OnPickerClicked;
+
+						try
+						{
+							// Tapping opens the picker. View.OnTouchEvent posts the click, so the main loop
+							// has to drain before it can be observed.
+							Tap(platformPicker);
+							await WaitForGestureToSettleAsync();
+
+							Assert.Equal(1, clicks);
+							Assert.Equal(restingScrollX, platformPicker.ScrollX);
+
+							// Dragging is not a tap: the text scrolls by the drag distance and the picker
+							// stays closed.
+							var dragDistance = Math.Min(platformPicker.Width / 2, maxScrollX - restingScrollX);
+							Assert.True(
+								dragDistance > GetTouchSlop(platformPicker),
+								$"The drag ({dragDistance}px) has to be longer than the touch slop ({GetTouchSlop(platformPicker)}px) to be recognized.");
+
+							DragHorizontally(platformPicker, dragDistance);
+
+							Assert.InRange(
+								platformPicker.ScrollX - restingScrollX,
+								dragDistance - ScrollTolerance,
+								dragDistance + ScrollTolerance);
+							Assert.InRange(platformPicker.ScrollX, minScrollX - ScrollTolerance, maxScrollX + ScrollTolerance);
+
+							await WaitForGestureToSettleAsync();
+
+							Assert.Equal(1, clicks);
+
+							// The gesture is still owned by View.OnTouchEvent, so its pressed state is
+							// released when the drag ends.
+							Assert.False(platformPicker.Pressed, "The picker was left pressed after a drag.");
+
+							// Tapping after a drag opens the picker again without moving the text.
+							var scrolledScrollX = platformPicker.ScrollX;
+
+							Tap(platformPicker);
+							await WaitForGestureToSettleAsync();
+
+							Assert.Equal(2, clicks);
+							Assert.Equal(scrolledScrollX, platformPicker.ScrollX);
+
+							// Selecting another item re-anchors the text instead of leaving it scrolled.
+							platformPicker.UpdatePickerCore(CreatePickerStub(AnotherLongItem));
+
+							await AssertEventually(
+								() => platformPicker.ScrollX == restingScrollX,
+								message: "Timed out waiting for a newly selected item to reset the scroll offset.");
+						}
+						finally
+						{
+							platformPicker.Click -= OnPickerClicked;
+						}
+					});
+				}
+				finally
+				{
+					DisposePicker(container, platformPicker);
+				}
+			});
+		}
+
+		[Theory(DisplayName = "Long Selected Text Stays Inside Its Scrollable Range")]
+		[InlineData(ATextAlignment.TextStart, false)]
+		[InlineData(ATextAlignment.Center, false)]
+		[InlineData(ATextAlignment.TextEnd, false)]
+		[InlineData(ATextAlignment.TextStart, true)]
+		public async Task LongSelectedTextStaysInsideScrollRange(ATextAlignment textAlignment, bool rightToLeft)
+		{
+			await InvokeOnMainThreadAsync(async () =>
+			{
+				var platformPicker = CreatePlatformPicker(useMaterialPicker: false, rightToLeft ? LongRtlItem : LongItem);
+				platformPicker.TextAlignment = textAlignment;
+
+				if (rightToLeft)
+				{
+					platformPicker.LayoutDirection = ALayoutDirection.Rtl;
+					platformPicker.TextDirection = ATextDirection.FirstStrongRtl;
+				}
+
+				var container = CreatePickerContainer(platformPicker);
+
+				try
+				{
+					await container.AttachAndRun(async () =>
+					{
+						// Center, End and RTL text is laid out inside a very wide layout, so its resting
+						// offset is not zero. Landing outside the range would show empty space.
+						await AssertEventually(
+							() => IsRestingInsideScrollRange(platformPicker),
+							message: $"Timed out waiting for {textAlignment} (rtl: {rightToLeft}) text to settle inside its scrollable range.");
+
+						var (minScrollX, maxScrollX) = GetScrollRange(platformPicker);
+						var overshoot = maxScrollX - minScrollX + GetTouchSlop(platformPicker) + platformPicker.Width;
+
+						DragHorizontally(platformPicker, overshoot);
+						Assert.InRange(platformPicker.ScrollX, maxScrollX - ScrollTolerance, maxScrollX + ScrollTolerance);
+
+						DragHorizontally(platformPicker, -overshoot);
+						Assert.InRange(platformPicker.ScrollX, minScrollX - ScrollTolerance, minScrollX + ScrollTolerance);
+					});
+				}
+				finally
+				{
+					DisposePicker(container, platformPicker);
+				}
+			});
+		}
+
 		MauiPicker GetNativePicker(PickerHandler pickerHandler) =>
 			pickerHandler.PlatformView;
 
+		// A selected item that is much wider than the picker, so that it can be scrolled.
+		const string LongItem = "This is a very long selected picker item that should scroll horizontally";
+		const string AnotherLongItem = "Another very long selected picker item that should also scroll horizontally";
+
+		// "\u05E4\u05E8\u05D9\u05D8" (Hebrew for "item") repeated: long enough to overflow and strongly RTL.
+		const string LongRtlItem =
+			"\u05E4\u05E8\u05D9\u05D8 \u05E4\u05E8\u05D9\u05D8 \u05E4\u05E8\u05D9\u05D8 \u05E4\u05E8\u05D9\u05D8 " +
+			"\u05E4\u05E8\u05D9\u05D8 \u05E4\u05E8\u05D9\u05D8 \u05E4\u05E8\u05D9\u05D8 \u05E4\u05E8\u05D9\u05D8";
+
+		// Touch scrolling and the layout bounds it clamps against are computed in whole pixels from floats.
+		const int ScrollTolerance = 1;
+
+		static PickerStub CreatePickerStub(string item) =>
+			new PickerStub
+			{
+				Items = new List<string> { item },
+				SelectedIndex = 0
+			};
+
+		AppCompatEditText CreatePlatformPicker(bool useMaterialPicker, string item)
+		{
+			var picker = CreatePickerStub(item);
+
+			AppCompatEditText platformPicker = useMaterialPicker
+				? new MauiMaterialPicker(MauiContext.Context)
+				: new MauiPicker(MauiContext.Context);
+
+			platformPicker.UpdatePickerCore(picker);
+
+			return platformPicker;
+		}
+
+		// Sizes are derived from the display density so the item overflows the picker on any device.
+		FrameLayout CreatePickerContainer(AView platformPicker)
+		{
+			var density = MauiContext.Context.Resources.DisplayMetrics.Density;
+			var container = new FrameLayout(MauiContext.Context);
+
+			container.AddView(platformPicker, new FrameLayout.LayoutParams((int)(100 * density), (int)(48 * density)));
+
+			return container;
+		}
+
+		static void DisposePicker(FrameLayout container, AView platformPicker)
+		{
+			container.RemoveView(platformPicker);
+			platformPicker.Dispose();
+			container.Dispose();
+		}
+
+		static void AssertReadOnlyPicker(EditText platformPicker)
+		{
+			Assert.Equal(InputTypes.Null, platformPicker.InputType);
+			Assert.Null(platformPicker.KeyListener);
+			Assert.False(platformPicker.IsCursorVisible);
+			Assert.False(platformPicker.IsTextSelectable);
+			Assert.False(platformPicker.LongClickable);
+			Assert.True(platformPicker.Clickable);
+			Assert.True(platformPicker.Focusable);
+			Assert.False(platformPicker.FocusableInTouchMode);
+		}
+
+		static int GetTouchSlop(AView view) =>
+			ViewConfiguration.Get(view.Context).ScaledTouchSlop;
+
+		// The offsets the text can be scrolled between, which is what Android.Text.Method.Touch clamps to.
+		// They are only zero based for start aligned left to right text.
+		static (int Min, int Max) GetScrollRange(EditText platformPicker)
+		{
+			var layout = platformPicker.Layout;
+
+			if (layout is null)
+			{
+				return (0, 0);
+			}
+
+			var left = (int)Math.Floor(layout.GetLineLeft(0));
+			var right = (int)Math.Ceiling(layout.GetLineRight(0));
+			var availableWidth = platformPicker.Width - platformPicker.TotalPaddingLeft - platformPicker.TotalPaddingRight;
+
+			return (left, Math.Max(left, right - availableWidth));
+		}
+
+		static bool IsRestingInsideScrollRange(EditText platformPicker)
+		{
+			var (minScrollX, maxScrollX) = GetScrollRange(platformPicker);
+
+			return maxScrollX > minScrollX &&
+				platformPicker.ScrollX >= minScrollX - ScrollTolerance &&
+				platformPicker.ScrollX <= maxScrollX + ScrollTolerance;
+		}
+
+		static void Tap(EditText platformPicker) =>
+			DragHorizontally(platformPicker, 0);
+
+		// A positive distance drags the text to the left (increasing ScrollX), a zero distance is a tap.
+		static void DragHorizontally(EditText platformPicker, int distance)
+		{
+			var downTime = SystemClock.UptimeMillis();
+			var y = platformPicker.Height / 2f;
+			var startX = platformPicker.Width / 2f;
+
+			DispatchTouch(platformPicker, MotionEventActions.Down, downTime, downTime, startX, y);
+
+			if (distance != 0)
+			{
+				// The first move crosses the touch slop, the second one completes the drag.
+				var slopStep = Math.Sign(distance) * (GetTouchSlop(platformPicker) + 1);
+
+				DispatchTouch(platformPicker, MotionEventActions.Move, downTime, downTime + 16, startX - slopStep, y);
+				DispatchTouch(platformPicker, MotionEventActions.Move, downTime, downTime + 32, startX - distance, y);
+			}
+
+			DispatchTouch(platformPicker, MotionEventActions.Up, downTime, downTime + 48, startX - distance, y);
+		}
+
+		static void DispatchTouch(AView view, MotionEventActions action, long downTime, long eventTime, float x, float y)
+		{
+			using var motionEvent = MotionEvent.Obtain(downTime, eventTime, action, x, y, 0);
+
+			view.DispatchTouchEvent(motionEvent);
+		}
+
+		// View.OnTouchEvent drives the pressed state through delayed callbacks and posts PerformClick, so
+		// the main loop has to drain before the outcome of a gesture can be asserted.
+		static Task WaitForGestureToSettleAsync() =>
+			Task.Delay(ViewConfiguration.TapTimeout + ViewConfiguration.PressedStateDuration + 100);
+
 		string GetNativeTitle(PickerHandler pickerHandler) =>
 			GetNativePicker(pickerHandler).Hint;
 
@@ -123,4 +398,4 @@ namespace Microsoft.Maui.DeviceTests
 		GravityFlags GetNativeVerticalTextAlignment(PickerHandler pickerHandler) =>
 			GetNativePicker(pickerHandler).Gravity;
 	}
-}
\ No newline at end of file
+}

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Aug 5, 2026

@kubaflo kubaflo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please attach screenshots and verify failing tests?

@kubaflo

kubaflo commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Closing in favour of #37232

@kubaflo kubaflo closed this Aug 9, 2026
kubaflo added a commit that referenced this pull request Aug 11, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Aug 12, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Aug 27, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 2, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 3, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 3, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 4, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 6, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 7, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 7, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 8, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 8, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 9, 2026
)

<!-- 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

---------
kubaflo added a commit that referenced this pull request Sep 9, 2026
)

<!-- 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

---------
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 20, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-picker platform/android s/agent-changes-requested AI agent recommends changes - found a better alternative or issues s/agent-fix-win AI found a better alternative fix than the PR s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Android] Can not scroll horizontally long text into Picker's title placeholder

4 participants