Repository navigation
Fix SwipeView Threshold changes width and offset of the side menu (when visible) - #36878
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
|
Hey there @@KarthikRajaKalaimani! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
|
Azure Pipelines: Successfully started running 1 pipeline(s). There may be pipelines that require an authorized user to comment /azp run to run. |
addressed the Ai summary concerns |
|
/azp run maui-pr-uitests , maui-pr-devicetests |
|
Azure Pipelines: Successfully started running 2 pipeline(s). |
This comment has been minimized.
This comment has been minimized.
AI Review Summary
🗂️ Review Sessions — click to expand🚦 Gate — Test Before & After FixGate Result: ✅ PASSEDPlatform: ANDROID · Base: inflight/candidate · Merge base: ✅ Fix verified — 1 test(s) reproduce the bug (FAIL without the fix → PASS with it). 1 test(s) pass in both states and are not bug-reproducing; under the "at least one test reproduces the bug and none regress" rule they don't block the gate.
🔴 Without fix — 🖥️ Issue6016: FAIL ✅ · 1851sError-relevant lines (filtered from the build log): 🟢 With fix — 🖥️ Issue6016: PASS ✅ · 588s(no coded error found; showing last 1200 chars) 🔴 Without fix — 🖥️ Issue7580: PASS ❌ · 1758s(no coded error found; showing last 1200 chars) 🟢 With fix — 🖥️ Issue7580: PASS ✅ · 567s(no coded error found; showing last 1200 chars)
|
| Category | Tests | Snapshot diffs |
|---|---|---|
SwipeView |
78/78 ✓ | — |
ViewBaseTests |
118/119 ✓ | — |
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs) |
📋 Pre-Flight — Context & Validation
Issue: #6016 - SwipeView Threshold changes width and offset of the side menu
PR: #36878 - Fix SwipeView Threshold changes width and offset of the side menu (when visible)
Platforms Affected: Android, iOS, MacCatalyst
Files Changed: 3 implementation, 11 test/snapshot
Key Findings
- PR Fix SwipeView Threshold changes width and offset of the side menu (when visible) #36878 fixes the reported visual regression by decoupling
SwipeView.Thresholdfrom SwipeItem menu width and final open offset. - The linked issue is SwipeView Threshold changes width and offset of the side menu (when visible) #6016. The PR also preserves/fixes regression coverage for Changing visibility on an SwipeItem causes multiple items to be executed #7580 (
SwipeItemVisibilityChangeShouldNotInvokeTwice) by addingSwipeContentautomation targeting. ghCLI is unauthenticated in this environment, so PR context was gathered from the public GitHub API and localpr-review-36878checkout. Required CI status could not be authenticated throughgh pr checks.- Prior MauiBot review and the current code-review pass both identified the same unresolved concern: the PR's
Math.Min(Threshold, GetSwipeOpenDistance())trigger calculation caps large explicit thresholds to menu width.
Code Review Summary
Verdict: NEEDS_CHANGES
Confidence: low
Errors: 1 | Warnings: 0 | Suggestions: 0
Key code review findings:
- ✗
src/Core/src/Platform/Android/MauiSwipeView.cs:1017-1020,src/Core/src/Platform/Android/MauiSwipeView.cs:1428-1430,src/Core/src/Platform/iOS/MauiSwipeView.cs:774-777,src/Core/src/Platform/iOS/MauiSwipeView.cs:1217-1219: explicitThresholdis capped to menu open distance, so large thresholds stop behaving as a requested minimum swipe distance. - Failure mode:
Threshold=200with a one-item menu around 100dp opens once the content reaches menu width instead of requiring the larger configured threshold. - Blast radius: all Android/iOS/MacCatalyst
SwipeViewinstances on touch/open paths; no startup or static-state impact.
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #36878 | Decouple Threshold from item size/open offset; trigger at Math.Min(Threshold, openDistance) |
✅ PASSED (Gate pre-run) | MauiSwipeView.cs, SwipeViewExtensions.cs, UI tests/snapshots |
Original PR; leaves large-threshold semantic concern |
🔬 Code Review — Deep Analysis
Code Review — PR #36878
Independent Assessment
What this changes: Decouples SwipeView.Threshold from SwipeItem sizing/final open distance on Android/iOS, uses it as an activation threshold capped by open distance, updates SwipeView UI tests/snapshots, and fixes Issue7580 test targeting.
Inferred motivation: Fix #6016 where setting Threshold made menus wider and changed opened content offset.
Reconciliation with PR Narrative
Author claims: Threshold should control trigger distance only, not menu size or final offset; PR #36713 reverted prior behavior.
Agreement/disagreement: The sizing/open-offset fix matches the claim. However, capping explicit Threshold to open distance means large threshold values no longer behave as a “minimum swipe distance.”
Prior Review Reconciliation
| Prior ❌ Error Finding | Source | Status | Evidence |
|---|---|---|---|
Large Threshold values are ignored as a minimum swipe distance |
MauiBot issue comment, 2026-07-28 | ❌ Unresolved | Current code still uses Math.Min(Threshold, GetSwipeOpenDistance()) in Android/iOS activation paths. |
Updated Issue7580 test waits for missing SwipeContent AutomationId |
MauiBot issue comment, 2026-07-28 | ✅ Fixed | Issue7580.cs host page now sets AutomationId = "SwipeContent"; latest iOS log shows SwipeItemVisibilityChangeShouldNotInvokeTwice passed. |
External Output Contract
| Consumer token/pattern | Producer location | Producer emission condition | Consumer assumption | Ordinary negative case | Downstream effect |
|---|---|---|---|---|---|
| N/A | N/A | No changed code classifies external tool output | N/A | N/A | N/A |
Blast Radius Assessment
- Runs for all instances: Yes, all Android/iOS/MacCatalyst SwipeViews.
- Startup impact: No; touch/open/layout paths only.
- Static/shared state: No new static state; per-instance
_swipeOpenDistancecache.
CI Status
- Required-check result:
gh pr checks --requiredtool-unavailable;ghunauthenticated. - Fallback result: public check-runs show failures:
Build Analysisandmaui-pr-uitests. - Classification: Undetermined/CI red; visible iOS UITest failure includes a touched snapshot (
ItemImageSourceShouldBeVisible.png). - Action taken: Invoked
azdo-build-investigatorguidance, inspected public AzDO logs, capped confidence low.
Findings
❌ Error — Explicit Threshold is capped to menu open distance
src/Core/src/Platform/Android/MauiSwipeView.cs:1017-1020, :1428-1430, and src/Core/src/Platform/iOS/MauiSwipeView.cs:774-777, :1217-1219 use Math.Min(Element.Threshold, GetSwipeOpenDistance()).
That fixes menu width/offset, but if a developer sets Threshold larger than the menu width, the swipe opens once the menu open distance is reached, not after the requested threshold distance. This conflicts with the documented “swipe distance that must be achieved” behavior and leaves the prior ❌ finding unresolved.
Failure-Mode Probing
- Large threshold (
Threshold=200, menu width 100): opens at 100, not 200. - Default threshold (
0): still uses 60% of open distance. - Execute mode with visibility changes: current Issue7580 selector fix passes in latest inspected iOS log.
- Handler reconnect/reset: no new subscriptions; cached open distance is cleared on reset/visibility update.
Verdict: NEEDS_CHANGES
Confidence: low
Summary: The main sizing fix is directionally correct, and one prior test bug is fixed. But an unresolved threshold-semantics error remains, and CI is still red/undetermined via fallback inspection.
🛠️ Fix — Analysis & Comparison
Fix Candidates
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| 1 | try-fix | Track raw Android gesture distance separately and require explicit Threshold to be fully reached before open/execute |
❌ Failed | 1 file | Preserves literal large-threshold semantics, but failed Issue6016.LeftItems and Issue6016.RightItems because Threshold=200 row did not open under the gate gesture |
| 2 | try-fix | Use legacy Android completion semantics for explicit thresholds: trigger at OpenSwipeThresholdPercentage * Threshold, while final open offset remains menu width |
✅ Passed | 1 file | Avoids direct cap to menu width and passes targeted Android gate/regression tests |
| PR | PR #36878 | Decouple Threshold from item size/open offset; trigger at Math.Min(Threshold, openDistance) |
✅ PASSED (Gate) | 3 implementation files plus tests/snapshots | Original PR; simpler but caps large explicit threshold to menu width |
Cross-Pollination
| Model | Round | New Ideas? | Details |
|---|---|---|---|
| gpt-5.5 maui-expert-reviewer | 2 | No | NO NEW IDEAS |
Exhausted: Yes
Selected Fix: Candidate #2 — It passes the Android targeted gate/regression tests and is demonstrably better than the PR's Android trigger calculation because it removes the direct Math.Min(Threshold, openDistance) cap while preserving the expected visual menu width/open offset behavior. It is still a compatibility compromise rather than literal full-distance threshold semantics; try-fix-1 showed literal semantics fail the existing gate.
Candidate details
try-fix-1: seeCustomAgentLogsTmp/PRState/36878/PRAgent/try-fix-1/content.mdtry-fix-2: seeCustomAgentLogsTmp/PRState/36878/PRAgent/try-fix-2/content.md
📝 Recommended PR Title & Description
Assessment: ✏️ Recommend updating - the current description accurately explains the visual sizing fix but is stale for the winning trigger calculation, and the title should identify the affected platforms/component.
Recommended title
[Android/iOS] SwipeView: Decouple Threshold from menu size and open offset
Recommended description
## Issue Details
SwipeView Threshold changes width and offset of the side menu when visible.
## Root Cause
The SwipeView.Threshold property controls the swipe distance used to recognize a swipe gesture. It should not determine how wide the revealed swipe items are, nor how far the content settles after the menu opens.
Android, iOS, and MacCatalyst were incorrectly using Threshold in unrelated calculations:
1. GetSwipeItemSize() used Threshold as the swipe item width when Threshold was greater than zero, so Threshold=200 inflated each menu item instead of using the configured WidthRequest or the default SwipeItemWidth.
2. The open-distance calculation returned the Threshold value directly, so opened content settled at the Threshold offset instead of the actual menu width.
Together, those paths caused both the side menu width and the final content displacement to change when Threshold was set.
## Description of Change
The fix separates three concepts that were previously conflated:
- Swipe item visual size now comes from the item's configured WidthRequest or the default SwipeItemWidth.
- Final open offset now comes from the actual revealed menu width/open distance.
- Explicit Threshold remains part of the gesture trigger calculation and is not used as the visual menu width or final open offset.
For explicit Threshold values, the trigger calculation follows the platform SwipeView completion model by using OpenSwipeThresholdPercentage * Threshold. When Threshold is not set, the existing default behavior remains OpenSwipeThresholdPercentage * openDistance.
This was applied consistently across:
- src/Core/src/Platform/Android/MauiSwipeView.cs
- src/Core/src/Platform/iOS/MauiSwipeView.cs
- src/Core/src/Platform/iOS/SwipeViewExtensions.cs
The PR also keeps the Issue7580 regression coverage by targeting the SwipeView content area directly and ensuring Execute mode invokes only the first visible SwipeItem.
## What NOT to Do
- Do not use Threshold as the SwipeItem width. That recreates #6016 by making menus visually wider when Threshold is set.
- Do not use Threshold as the final open offset. The content should settle at the actual menu width/open distance.
- Do not directly clamp explicit Threshold to menu width for the trigger path. The trigger distance and visual open distance should remain separate.
## Platforms
- Android
- iOS
- MacCatalyst
Windows is not changed by this fix.
## Issues Fixed
Fixes #6016
## Note
PR #36713 was reverted due to behavior confirmation.
🏁 Report — Final Recommendation
Comparative Report - PR #36878
Candidates Compared
| Candidate | Test Result | Summary | Rank |
|---|---|---|---|
pr-plus-reviewer |
Pass evidence for Android gate via try-fix-2; iOS/MacCatalyst adjusted by same reviewed pattern | Keeps the PR's visual fix and applies expert feedback so explicit Threshold is no longer directly capped to menu open distance. |
1 |
try-fix-2 |
Passed Android gate/regression tests | Best independent try-fix candidate. Uses OpenSwipeThresholdPercentage * Threshold for Android explicit thresholds, but only addresses Android and does not apply the same correction to iOS/MacCatalyst. |
2 |
pr |
Gate passed, but expert review found an unresolved correctness issue | Fixes menu width/open offset but uses Math.Min(Threshold, openDistance), so large explicit thresholds collapse to menu width. |
3 |
try-fix-1 |
Failed Android gate (Issue6016.LeftItems and Issue6016.RightItems) |
Preserves literal full-distance threshold semantics, but the threshold row did not open under the regression gesture, so it must rank below passing candidates. | 4 |
Analysis
The raw PR is directionally correct for #6016: it removes Threshold from menu item sizing and final open offset, so Threshold=200 no longer bloats the side menu or moves content by 200dp/pt. The expert reviewer found that the raw trigger calculation overcorrects by clamping explicit thresholds to the computed open distance. That means a threshold larger than the menu width no longer acts as a distinct trigger distance.
try-fix-1 is the strictest semantic interpretation because it requires the raw drag distance to reach the full explicit threshold. It failed the required Android regression gate, so it is not viable under the ordering rule that failed candidates rank below passing candidates.
try-fix-2 is the strongest STEP 5a candidate. It restores the platform's previous 60%-completion model for explicit thresholds while keeping the PR's visual open distance fix, and it passed the Android gate/regression tests. Its limitation is scope: it only changes Android, while the PR's regression and expert finding also apply to iOS/MacCatalyst.
pr-plus-reviewer combines the raw PR with the expert-review correction. It keeps the passing Android behavior represented by try-fix-2 and applies the same trigger-helper pattern to iOS/MacCatalyst, resolving both expert inline findings without reintroducing threshold-based menu sizing or offset.
Winner
Winner: pr-plus-reviewer
Rationale: pr-plus-reviewer is the most complete candidate because it preserves the PR's user-visible fix, incorporates the passing Android trigger approach from try-fix-2, and applies the same expert-review correction to iOS/MacCatalyst. It ranks above pr because the raw PR leaves the explicit-threshold cap unresolved, and above try-fix-2 because it covers all affected platforms.
🧭 Next Steps — review latest findings
No alternative fix was selected for this run. Review the session findings and CI results before merging.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Issue Details
SwipeView Threshold changes width and offset of the side menu (when visible) Opened.
Root Cause
The SwipeView.Threshold property is designed for a single purpose: setting the minimum drag distance a user must swipe before the menu snaps open. It has nothing to do with how wide the menu
items should appear or where the content settles after the swipe. However, the platform code on both iOS and Android was incorrectly using this value in two unrelated calculations.
The first misuse was in GetSwipeItemSize(), where the code checked if Threshold > 0 and, if so, used the threshold value as the item's width. This meant that setting Threshold=200 would inflate
every swipe item to 200pt wide, far larger than the intended ~100pt. The second misuse was in GetSwipeThreshold(ISwipeItems), which had an early return that directly handed back the Threshold
value as the snap-open distance. So the content would snap to 200pt offset instead of snapping to the actual menu width. Together, these two bugs caused both the menu to look bloated and the
content displacement to differ depending on whether Threshold was set.
Description of Change
The fix removes Threshold from both of those calculations entirely. Item sizing now uses only the item's configured WidthRequest or the default SwipeItemWidth, as it should. The snap distance is now computed as Math.Min(Threshold, menuWidth) — meaning if Threshold is set, it acts as a cap on how far the user needs to drag, but the content still snaps to the true menu width. If Threshold is not set, the default behaviour of 60% of menu width is preserved. This was applied consistently across iOS (MauiSwipeView.cs and SwipeViewExtensions.cs) and Android (MauiSwipeView.cs).
Tested the behavior in the following platforms.
Issue Fixed
Fixed #6016
Screenshots