Skip to content

[Android, iOS/Mac] Fix IsSwipeEnabled Not Working on CarouselView - #36428

Merged
kubaflo merged 7 commits into
dotnet:inflight/currentfrom
Dhivya-SF4094:fix-36267
Jul 14, 2026
Merged

kubaflo merged 7 commits into
dotnet:inflight/currentfrom
Dhivya-SF4094:fix-36267

Conversation

@Dhivya-SF4094

@Dhivya-SF4094 Dhivya-SF4094 commented Jul 7, 2026 •

Copy link
Copy Markdown
Contributor

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 Detail

CarouselView2 does not respect the IsSwipeEnabled setting.

Root Cause

iOS:

  • CarouselView2 uses UICollectionViewCompositionalLayout with OrthogonalScrollingBehavior, which internally creates a private embedded UIScrollView that handles paging and swipe gestures. Disabling UICollectionView.ScrollEnabled does not affect this internal scroller. The previous fix (PR [iOS] Support for IsSwipeEnabled on CarouselView2 #29996) only reapplied the swipe state when the embedded scroller was added through AddSubview, leaving two scenarios uncovered: the scroller could already exist before the IsSwipeEnabled mapper executed during initial layout, or UIKit could add it through other insertion APIs such as InsertSubview or InsertSubviewBelow.

  • Additionally, disabling scrolling (ScrollEnabled = false) does not disable rubber-band (bounce) behavior because bouncing is controlled by the independent Bounces and AlwaysBounce properties. The embedded scroller also ignored the existing IsBounceEnabled property and instead tied its bounce behavior directly to the swipe state, causing inconsistent behavior between the outer collection view and the internal scroller.

Android:

MauiCarouselRecyclerView already prevented gesture interception when IsSwipeEnabled was false by overriding OnInterceptTouchEvent. However, Android's touch dispatch can invoke OnTouchEvent directly when a child view does not consume the initial ACTION_DOWN event (for example, when the touch begins on an empty area of the carousel). Since OnTouchEvent did not check IsSwipeEnabled, the RecyclerView could still process the gesture and scroll.

Description of Change

iOS:

  • Cache the current swipe and bounce state and reapply it whenever subviews are added.
  • Override LayoutSubviews() to reapply the cached state on every layout pass, ensuring the embedded orthogonal scroller is updated regardless of when or how it is created.
  • Apply ScrollEnabled, Bounces, AlwaysBounceHorizontal, and AlwaysBounceVertical consistently to both the outer UICollectionView and the embedded orthogonal UIScrollView.
  • Update the embedded scroller to honor the existing IsBounceEnabled property independently of IsSwipeEnabled, matching the behavior of the outer collection view.

Android:

  • Added an IsSwipeEnabled check to OnTouchEvent, matching the existing guard in OnInterceptTouchEvent, so direct touch dispatch can no longer initiate scrolling when swipe is disabled.

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed:

Fixes #36267

Screenshots

Before  After 
 
36267_Beforefix_iOS.mov
  
36267_AfterFix_iOS.mov

@github-actions

github-actions Bot commented Jul 7, 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 -- 36428

Or

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

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 7, 2026
@Dhivya-SF4094 Dhivya-SF4094 changed the title [WIP] [Android, iOS/Mac] Fix IsSwipeEnabled Not Working on CarouselView [Android, iOS/Mac] Fix IsSwipeEnabled Not Working on CarouselView Jul 10, 2026
@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 Jul 13, 2026

@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.

Expert Review — 1 findings

See inline comments for details.

// one of the two does not reliably suppress bounce. Only the embedded scroller's
// ScrollEnabled is toggled; the outer CollectionView's ScrollEnabled is left untouched so
// unrelated scrolling (e.g. main-axis list scrolling) keeps working.
ApplyOuterBounceState(enabled);

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-Generated Review (multi-model)

[major] CollectionView iOS/MacCatalyst — This leaves the outer UICollectionView.ScrollEnabled unchanged, but vertical CarouselView2 layouts do not use an embedded orthogonal scroller (LayoutFactory2 sets OrthogonalScrollingBehavior.None for vertical layouts), so the outer collection view is the view that handles the user drag. Concrete scenario: a vertical CarouselView with IsSwipeEnabled=false will still scroll between items because only bounce is disabled here and no embedded UIScrollView exists to receive ScrollEnabled=false. Please also disable the outer pan/scroll path for CarouselView vertical layouts while preserving the horizontal embedded-scroller behavior.

@MauiBot MauiBot added s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-reviewed PR was reviewed by AI agent workflow (full 4-phase review) labels Jul 13, 2026
MauiBot

This comment was marked as outdated.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Jul 13, 2026
@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 Jul 13, 2026

@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.

Expert Review — 1 findings

See inline comments for details.

// Bounce must be reapplied on the outer UICollectionView itself (it is a UIScrollView) as
// well as any embedded orthogonal scroller - confirmed empirically that setting it on only
// one of the two does not reliably suppress bounce. Only the embedded scroller's
// ScrollEnabled is toggled; the outer CollectionView's ScrollEnabled is left untouched so

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-Generated Review (multi-model)

[major] Logic and Correctness — SetSwipeEnabled(false) never disables the outer UICollectionView.ScrollEnabled; it only applies ScrollEnabled to embedded non-UICollectionView scroll views. LayoutFactory2.CreateCarouselLayout uses OrthogonalScrollingBehavior.None for vertical CarouselView2, so vertical paging is performed by this outer collection view and remains swipeable when IsSwipeEnabled=false at initial load. Please also apply the swipe state to the outer collection view for vertical layouts while keeping the horizontal embedded-scroller path enabled.

@sheiksyedm
sheiksyedm marked this pull request as ready for review July 13, 2026 11:11
Copilot AI review requested due to automatic review settings July 13, 2026 11:11

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

Fixes CarouselView2.IsSwipeEnabled not being respected on iOS/MacCatalyst (embedded orthogonal UIScrollView) and Android (direct OnTouchEvent dispatch), and adds a regression UI test for issue #36267.

Changes:

  • iOS/MacCatalyst: cache swipe/bounce state and reapply it during subview insertion and LayoutSubviews() for both the outer UICollectionView and embedded orthogonal scrollers.
  • Android: guard MauiCarouselRecyclerView.OnTouchEvent with IsSwipeEnabled to prevent scroll initiation when swipe is disabled.
  • Tests: add HostApp repro page + NUnit/Appium regression tests for “IsSwipeEnabled=false at load time”.

Reviewed changes

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

Show a summary per file
File Description
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36267.cs Adds UI regression coverage for load-time and toggled IsSwipeEnabled scenarios.
src/Controls/tests/TestCases.HostApp/Issues/Issue36267.cs Adds HostApp issue page that reproduces the CV2 swipe-disabled-at-load scenario.
src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt Records new public override surface (MauiCollectionView.LayoutSubviews) for MacCatalyst.
src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt Records new public override surface (MauiCollectionView.LayoutSubviews) for iOS.
src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs Routes swipe/bounce mapping through MauiCollectionView state application helpers.
src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs Applies swipe/bounce state to embedded orthogonal scrollers and outer collection view during layout/subview changes.
src/Controls/src/Core/Handlers/Items/Android/MauiCarouselRecyclerView.cs Prevents RecyclerView gesture handling when IsSwipeEnabled is false even if OnTouchEvent is invoked directly.

Comment on lines +14 to +16
public override string Issue => "[iOS] IsSwipeEnabled Not Working on CarouselView (CV2) when set to false at load time";

[Test]
Comment on lines +44 to +47
// Enable swipe gestures and verify swiping now works.
App.Tap("ToggleSwipeButton");
App.ScrollRight("CarouselView", swipePercentage: 0.8);
App.WaitForElement("Item2");
MauiBot

This comment was marked as outdated.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Jul 13, 2026
@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 Jul 14, 2026

@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

@Dhivya-SF4094 — new AI review results are available based on this last commit: b2a5a2a. To request a fresh review after new comments or commits, comment /review rerun.

Gate Passed Confidence Low Platform iOS


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

Gate Result: ✅ PASSED

Platform: IOS · Base: main · Merge base: 0395a53b

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue36267 Issue36267 ✅ FAIL — 271s ✅ PASS — 104s
🔴 Without fix — 🖥️ Issue36267: FAIL ✅ · 271s
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 474 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 478 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 5.48 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/Foldable/src/Controls.Foldable.csproj (in 5.72 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj (in 5.73 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 5.73 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Xaml/Controls.Xaml.csproj (in 5.73 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/BlazorWebView/src/Maui/Microsoft.AspNetCore.Components.WebView.Maui.csproj (in 5.73 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 5.73 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/maps/src/Maps.csproj (in 5.74 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/Maps/src/Controls.Maps.csproj (in 5.74 sec).
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-ios26.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-ios26.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-ios26.0/Microsoft.Maui.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Maps.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Xaml.dll
  Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-ios26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Maps.dll
  Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Foldable.dll
  Detected signing identity:
    Code Signing Key: "" (-)
    Provisioning Profile: "" () - no entitlements
    Bundle Id: com.microsoft.maui.uitests
    App Id: com.microsoft.maui.uitests
  Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.

Build succeeded.

/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:02:00.20
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils/VisualTestUtils.csproj (in 681 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/CustomAttributes/Controls.CustomAttributes.csproj (in 691 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 683 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 696 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 696 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Core/UITest.Core.csproj (in 683 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 730 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 770 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.NUnit/UITest.NUnit.csproj (in 1.07 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Appium/UITest.Appium.csproj (in 1.82 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/UITest.Analyzers/UITest.Analyzers.csproj (in 2.45 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/TestUtils/src/VisualTestUtils.MagickNet/VisualTestUtils.MagickNet.csproj (in 2.28 sec).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.iOS.Tests/Controls.TestCases.iOS.Tests.csproj (in 3.02 sec).
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
  Controls.TestCases.iOS.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.05]   Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.14]   Discovered:  Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
   NUnit3TestExecutor discovered 2 of 2 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 7/14/2026 5:19:50 AM FixtureSetup for Issue36267(iOS)
>>>>> 7/14/2026 5:19:54 AM IsSwipeEnabledCanBeEnabledAfterStartingDisabled Start
>>>>> 7/14/2026 5:20:10 AM IsSwipeEnabledCanBeEnabledAfterStartingDisabled Stop
>>>>> 7/14/2026 5:20:10 AM Log types: syslog, crashlog, performance, safariConsole, safariNetwork, server
  Failed IsSwipeEnabledCanBeEnabledAfterStartingDisabled [16 s]
  Error Message:
   System.TimeoutException : Timed out waiting for element...
  Stack Trace:
     at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2757
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2784
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 793
   at Microsoft.Maui.TestCases.Tests.Issues.Issue36267.IsSwipeEnabledCanBeEnabledAfterStartingDisabled() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36267.cs:line 42
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

>>>>> 7/14/2026 5:20:11 AM IsSwipeEnabledFalseFromStartDisablesSwipeGestures Start
>>>>> 7/14/2026 5:20:26 AM IsSwipeEnabledFalseFromStartDisablesSwipeGestures Stop
>>>>> 7/14/2026 5:20:26 AM Log types: syslog, crashlog, performance, safariConsole, safariNetwork, server
  Failed IsSwipeEnabledFalseFromStartDisablesSwipeGestures [15 s]
  Error Message:
   System.TimeoutException : Timed out waiting for element...
  Stack Trace:
     at UITest.Appium.HelperExtensions.Wait(Func`1 query, Func`2 satisfactory, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2757
   at UITest.Appium.HelperExtensions.WaitForAtLeastOne(Func`1 query, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 2784
   at UITest.Appium.HelperExtensions.WaitForElement(IApp app, String marked, String timeoutMessage, Nullable`1 timeout, Nullable`1 retryFrequency, Nullable`1 postTimeout) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 793
   at Microsoft.Maui.TestCases.Tests.Issues.Issue36267.IsSwipeEnabledFalseFromStartDisablesSwipeGestures() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue36267.cs:line 23
   at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)

NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue36267.trx

Total tests: 2
Test Run Failed.
     Failed: 2
 Total time: 1.6641 Minutes
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue36267.trx

🟢 With fix — 🖥️ Issue36267: PASS ✅ · 104s
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 366 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 372 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 376 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 403 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 414 ms).
  6 of 11 projects are up-to-date for restore.
/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0-ios26.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0-ios26.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0-ios26.0/Microsoft.Maui.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Maps.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Microsoft.AspNetCore.Components.WebView.Maui -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Microsoft.AspNetCore.Components.WebView.Maui/Debug/net10.0-ios26.0/Microsoft.AspNetCore.Components.WebView.Maui.dll
  Controls.Foldable -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Foldable/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Foldable.dll
  Controls.Maps -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Maps/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Maps.dll
  Controls.Xaml -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Xaml/Debug/net10.0-ios26.0/Microsoft.Maui.Controls.Xaml.dll
  Detected signing identity:
    Code Signing Key: "" (-)
    Provisioning Profile: "" () - no entitlements
    Bundle Id: com.microsoft.maui.uitests
    App Id: com.microsoft.maui.uitests
  Controls.TestCases.HostApp -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.HostApp/Debug/net10.0-ios/iossimulator-arm64/Controls.TestCases.HostApp.dll
  Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink
  Optimizing assemblies for size. This process might take a while.

Build succeeded.

/Users/cloudtest/vss/_work/1/s/.dotnet/packs/Microsoft.iOS.Sdk.net10.0_26.0/26.0.11017/targets/Xamarin.Shared.Sdk.targets(309,3): warning : RuntimeIdentifier was set on the command line, and will override the value for RuntimeIdentifiers set in the project file. [/Users/cloudtest/vss/_work/1/s/src/Controls/tests/TestCases.HostApp/Controls.TestCases.HostApp.csproj::TargetFramework=net10.0-ios]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:46.66
  Determining projects to restore...
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/BindingSourceGen/Controls.BindingSourceGen.csproj (in 341 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Essentials/src/Essentials.csproj (in 353 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Graphics/src/Graphics/Graphics.csproj (in 317 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Core/src/Core.csproj (in 369 ms).
  Restored /Users/cloudtest/vss/_work/1/s/src/Controls/src/Core/Controls.Core.csproj (in 377 ms).
  8 of 13 projects are up-to-date for restore.
  Controls.CustomAttributes -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.CustomAttributes/Debug/net10.0/Controls.CustomAttributes.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Graphics -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Graphics/Debug/net10.0/Microsoft.Maui.Graphics.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Essentials -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Essentials/Debug/net10.0/Microsoft.Maui.Essentials.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Core/Debug/net10.0/Microsoft.Maui.dll
  Controls.BindingSourceGen -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.BindingSourceGen/Debug/netstandard2.0/Microsoft.Maui.Controls.BindingSourceGen.dll
  ##vso[build.updatebuildnumber]10.0.100-ci+azdo.14650591
  Controls.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.Core/Debug/net10.0/Microsoft.Maui.Controls.dll
  UITest.Core -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Core/Debug/net10.0/UITest.Core.dll
  VisualTestUtils -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils/Debug/netstandard2.0/VisualTestUtils.dll
  UITest.Appium -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Appium/Debug/net10.0/UITest.Appium.dll
  VisualTestUtils.MagickNet -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/VisualTestUtils.MagickNet/Debug/netstandard2.0/VisualTestUtils.MagickNet.dll
  UITest.NUnit -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.NUnit/Debug/net10.0/UITest.NUnit.dll
  UITest.Analyzers -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/UITest.Analyzers/Debug/netstandard2.0/UITest.Analyzers.dll
  Controls.TestCases.iOS.Tests -> /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
Test run for /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll (.NETCoreApp,Version=v10.0)
VSTest version 18.0.1 (arm64)

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.8.2+699d445a1a (64-bit .NET 10.0.0)
[xUnit.net 00:00:00.04]   Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.15]   Discovered:  Controls.TestCases.iOS.Tests
NUnit Adapter 4.5.0.0: Test execution started
Running selected tests in /Users/cloudtest/vss/_work/1/s/artifacts/bin/Controls.TestCases.iOS.Tests/Debug/net10.0/Controls.TestCases.iOS.Tests.dll
   NUnit3TestExecutor discovered 2 of 2 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 7/14/2026 5:22:03 AM FixtureSetup for Issue36267(iOS)
>>>>> 7/14/2026 5:22:06 AM IsSwipeEnabledCanBeEnabledAfterStartingDisabled Start
>>>>> 7/14/2026 5:22:11 AM IsSwipeEnabledCanBeEnabledAfterStartingDisabled Stop
  Passed IsSwipeEnabledCanBeEnabledAfterStartingDisabled [4 s]
>>>>> 7/14/2026 5:22:11 AM IsSwipeEnabledFalseFromStartDisablesSwipeGestures Start
>>>>> 7/14/2026 5:22:12 AM IsSwipeEnabledFalseFromStartDisablesSwipeGestures Stop
  Passed IsSwipeEnabledFalseFromStartDisablesSwipeGestures [1 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue36267.trx

Test Run Successful.
Total tests: 2
     Passed: 2
 Total time: 26.1344 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue36267.trx

📁 Fix files reverted (5 files)
  • src/Controls/src/Core/Handlers/Items/Android/MauiCarouselRecyclerView.cs
  • src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs
  • src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs
  • src/Controls/src/Core/PublicAPI/net-ios/PublicAPI.Unshipped.txt
  • src/Controls/src/Core/PublicAPI/net-maccatalyst/PublicAPI.Unshipped.txt

📱 UI Tests — CarouselView,CollectionView

Detected UI test categories: CarouselView,CollectionView

✅ Deep UI tests — 96 passed, 0 failed across 1 category on platform-pool agent (replaces in-process counts above). The HostApp built and the tests started for 1 category (CollectionView) but produced no results — the run was interrupted (most often the per-category time budget was hit, or an emulator/Appium hang). This is usually an infrastructure flake rather than a code problem; re-run the review to try again. See the build-output.log in the drop-deep-uitests artifact.

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
CarouselView 96/99 ✓ —
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

📋 Pre-Flight — Context & Validation

Issue: #36267 - [iOS] IsSwipeEnabled Not Working on CarouselView (CV2)
PR: #36428 - [Android, iOS/Mac] Fix IsSwipeEnabled Not Working on CarouselView
Platforms Affected: iOS, MacCatalyst, Android (testing requested: iOS)
Files Changed: 5 implementation/API, 2 test

Key Findings

  • The linked issue reproduces CarouselView2 on iOS ignoring IsSwipeEnabled="False" when configured from initial load.
  • PR current fix caches swipe/bounce state and reapplies it to embedded iOS compositional-layout scroll views during subview insertion/layout; Android adds an OnTouchEvent guard matching OnInterceptTouchEvent.
  • Prior inline review comments identify an unresolved vertical CarouselView2 gap: vertical layouts use the outer UICollectionView, not an embedded orthogonal scroller.
  • gh is unauthenticated in this environment, so GitHub checks/review APIs could not be used; public GitHub API/curl and local PR branch diff were used instead.

Code Review Summary

Verdict: NEEDS_CHANGES
Confidence: low
Errors: 1 | Warnings: 1 | Suggestions: 0

Key code review findings:

  • ✗ src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs:103-105 leaves the outer UICollectionView.ScrollEnabled enabled, so vertical CarouselView2 can still scroll when IsSwipeEnabled=false because LayoutFactory2 uses OrthogonalScrollingBehavior.None for vertical layouts.
  • ⚠ src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs:58-66 walks subviews on every layout pass after swipe is configured, which is a hot path.

Fix Candidates

# Source Approach Test Result Files Changed Notes
PR PR #36428 Cache swipe/bounce state; reapply to embedded iOS scroll views on subview insertion/layout; add Android OnTouchEvent guard ✅ PASSED (Gate) MauiCarouselRecyclerView.cs, MauiCollectionView.cs, CarouselViewHandler2.iOS.cs, PublicAPI, UI tests Original PR; gate result supplied by caller

🔬 Code Review — Deep Analysis

Code Review — PR #36428

Independent Assessment

What this changes: Adds additional CarouselView IsSwipeEnabled enforcement for Android touch handling and iOS/MacCatalyst CarouselView2 embedded scroll views, including bounce-state caching/reapplication during layout.
Inferred motivation: Ensure IsSwipeEnabled=false, especially when set before first layout, prevents user swipe navigation.

Reconciliation with PR Narrative

Author claims: PR fixes CarouselView IsSwipeEnabled on Android and iOS/Mac, including embedded compositional-layout scrollers and bounce behavior.
Agreement/disagreement: Android and horizontal iOS/Mac CarouselView2 paths appear aligned. Disagree for vertical CarouselView2: vertical layouts use the outer UICollectionView, but the PR intentionally leaves outer ScrollEnabled unchanged.

Prior Review Reconciliation

Prior ❌ Error Finding Source Status Evidence
[major] vertical CarouselView2 still scrolls because outer UICollectionView.ScrollEnabled remains enabled MauiBot inline comments and top-level review ❌ Unresolved Current MauiCollectionView.cs:103-105 only reapplies bounce state to the outer collection view. LayoutFactory2.cs:390-392 uses OrthogonalScrollingBehavior.None for vertical CarouselView2, so no embedded scroller receives ScrollEnabled=false.

Blast Radius Assessment

  • Runs for all instances: Yes for CarouselView2 iOS/Mac and CarouselView Android; plain CollectionView remains mostly unaffected because _isSwipeEnabled stays null.
  • Startup impact: Yes — initial-layout timing is central to this fix.
  • Static/shared state: No — new state is instance-local.

CI Status

  • Required-check result: undetermined; gh pr checks --required exited 4 because gh is unauthenticated.
  • Classification: undetermined
  • Action taken: capped confidence at low; no GitHub comments/reviews posted.

Findings

❌ Error — Vertical CarouselView2 still ignores IsSwipeEnabled=false

src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs:103-105 deliberately leaves the outer UICollectionView.ScrollEnabled unchanged and only applies ScrollEnabled to embedded non-UICollectionView scrollers. That works for horizontal CarouselView2, but vertical CarouselView2 uses OrthogonalScrollingBehavior.None, so the outer collection view handles dragging. A vertical CarouselView2 with IsSwipeEnabled=false can still scroll.

⚠️ Warning — Reapplying scroll state on every layout pass may be expensive

src/Controls/src/Core/Handlers/Items/iOS/MauiCollectionView.cs:58-66 walks Subviews on every LayoutSubviews once _isSwipeEnabled is set. This is a CarouselView layout hot path; consider caching/dirty-checking so unchanged state is not reapplied every layout pass.

Failure-Mode Probing

  • Vertical CarouselView2 with IsSwipeEnabled=false: outer UICollectionView remains scroll-enabled, so user drag can still change position.
  • Horizontal CarouselView2 with embedded scroller added late: layout/subview reapplication should disable the embedded scroller.
  • Android touch starting where intercept is bypassed: new OnTouchEvent guard returns false when swipe is disabled.
  • Non-carousel CollectionView: _isSwipeEnabled remains null, so new iOS layout work is skipped.

Verdict: NEEDS_CHANGES

Confidence: low (platform handler/startup-layout code plus CI undetermined)
Summary: The Android and horizontal iOS/Mac approaches look reasonable, but a prior major finding remains valid: vertical CarouselView2 still uses the outer collection view for scrolling and is not disabled. CI could not be verified because gh is unauthenticated.


🛠️ Fix — Analysis & Comparison

Fix Candidates

# Source Approach Test Result Files Changed Notes
1 expert try-fix Orientation-aware outer UICollectionView.ScrollEnabled ownership for vertical CarouselView2 ❌ FAIL 4 files iOS Issue36267 vertical test failed waiting for Item1; expert review found stale ScrollEnabled when switching vertical -> horizontal
2 expert try-fix Outer PanGestureRecognizer delegate gate for vertical CarouselView2 ❌ FAIL 4 files Initial compile fix required IUIGestureRecognizerDelegate; after fix, tests failed with app-running/crash symptoms, so delegate replacement was abandoned
3 expert try-fix Restorable/reapplied outer ScrollEnabled ownership for vertical CarouselView2 ❌ FAIL 4 files Horizontal Issue36267 tests passed; vertical runtime-orientation probe still moved to Position: 2
4 expert try-fix Toggle native PanGestureRecognizer.Enabled plus ScrollEnabled for vertical/embedded scrollers ❌ FAIL 4 files Horizontal Issue36267 tests passed; vertical runtime-orientation probe still moved to Position: 2
PR PR #36428 Cache swipe/bounce state and reapply to embedded iOS scroll views on insertion/layout; Android OnTouchEvent guard ✅ PASSED (Gate) 7 files Original PR; gate result supplied by caller

Cross-Pollination

Model/Reviewer Round New Ideas? Details
maui-expert-reviewer 1 Yes Candidate 1: orientation-aware outer scroll ownership for vertical CarouselView2
maui-expert-reviewer 2 Yes Candidate 2: gate outer pan recognizer via delegate instead of ScrollEnabled
maui-expert-reviewer 3 Yes Candidate 3: restore/reapply outer ScrollEnabled when vertical ownership changes
maui-expert-reviewer 4 Yes Candidate 4: toggle PanGestureRecognizer.Enabled rather than replacing delegate
maui-expert-reviewer Final No Recommended exhaustion; candidate 4 is not better than PR, and vertical orthogonal layout rewrite is too invasive

Exhausted: Yes
Selected Fix: PR's fix — It is the only approach with the supplied passing gate. None of the explored alternatives passed the targeted iOS Issue36267 run or proved better than the PR fix.

Environment Notes

  • gh is unauthenticated in this environment, so CI checks and private review APIs were unavailable.
  • EstablishBrokenBaseline.ps1 could not run because the worktree had unrelated dirty .github/ and skill files before this task began. The alternatives were therefore tested on the local PR review branch rather than a script-restored broken baseline.
  • No gate/content.md was created or overwritten.

📝 Recommended PR Title & Description

Assessment: ✏️ Recommend updating — the current description is strong overall, but one iOS bullet incorrectly says ScrollEnabled is applied to the outer UICollectionView; the implementation only applies outer bounce state and toggles ScrollEnabled on embedded orthogonal UIScrollView instances.

Recommended title

[Android, iOS/Mac] CarouselView: Fix IsSwipeEnabled handling

Recommended description

### Issue Detail
CarouselView2 does not respect the IsSwipeEnabled setting.

### Root Cause
**iOS:**

- CarouselView2 uses UICollectionViewCompositionalLayout with OrthogonalScrollingBehavior, which internally creates a private embedded UIScrollView that handles paging and swipe gestures. Disabling UICollectionView.ScrollEnabled does not affect this internal scroller. The previous fix (PR #29996) only reapplied the swipe state when the embedded scroller was added through AddSubview, leaving two scenarios uncovered: the scroller could already exist before the IsSwipeEnabled mapper executed during initial layout, or UIKit could add it through other insertion APIs such as InsertSubview or InsertSubviewBelow.

- Additionally, disabling scrolling (ScrollEnabled = false) does not disable rubber-band (bounce) behavior because bouncing is controlled by the independent Bounces and AlwaysBounce properties. The embedded scroller also ignored the existing IsBounceEnabled property and instead tied its bounce behavior directly to the swipe state, causing inconsistent behavior between the outer collection view and the internal scroller.

**Android:**

MauiCarouselRecyclerView already prevented gesture interception when IsSwipeEnabled was false by overriding OnInterceptTouchEvent. However, Android's touch dispatch can invoke OnTouchEvent directly when a child view does not consume the initial `ACTION_DOWN` event (for example, when the touch begins on an empty area of the carousel). Since OnTouchEvent did not check IsSwipeEnabled, the RecyclerView could still process the gesture and scroll.

### Description of Change
**iOS:**

- Cache the current swipe and bounce state and reapply it whenever subviews are added.
- Override LayoutSubviews() to reapply the cached state on every layout pass, ensuring the embedded orthogonal scroller is updated regardless of when or how it is created.
- Apply ScrollEnabled to embedded orthogonal `UIScrollView` instances, and apply Bounces, AlwaysBounceHorizontal, and AlwaysBounceVertical consistently to both the outer UICollectionView and embedded orthogonal `UIScrollView` instances.
- Update the embedded scroller to honor the existing IsBounceEnabled property independently of IsSwipeEnabled, matching the bounce behavior of the outer collection view.

**Android:**

- Added an IsSwipeEnabled check to OnTouchEvent, matching the existing guard in OnInterceptTouchEvent, so direct touch dispatch can no longer initiate scrolling when swipe is disabled.

### Validated the behaviour in the following platforms
- [x] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Issues Fixed:
Fixes #36267

### Screenshots
| Before | After |
|---------|--------|
| <video src="https://github.com/user-attachments/assets/2b0e8ecb-da19-4b6c-94f6-f56bbf36ae02"> | <video src="https://github.com/user-attachments/assets/3c23a0b2-d7f9-4962-b7b3-2aa72ce10752"> |

🏁 Report — Final Recommendation

Comparative Report — PR #36428

Candidates compared

Rank Candidate Regression result Assessment
1 pr ✅ PASS The submitted PR is the only candidate with the supplied passing gate: Issue36267 tests fail without the fix and pass with the fix on iOS. The Android touch-dispatch guard and iOS/MacCatalyst embedded-scroll-view reapplication are targeted and match the bug evidence.
1 pr-plus-reviewer ✅ PASS The expert reviewer produced no actionable inline findings and no patch, so this candidate is equivalent to pr. It does not improve on the submitted PR, but it also does not introduce risk.
3 try-fix-1 ❌ FAIL Orientation-aware outer UICollectionView.ScrollEnabled ownership attempted to cover vertical CarouselView2, but failed the Issue36267 run and had a stale native-state bug when switching vertical back to horizontal while swipe remained disabled.
4 try-fix-3 ❌ FAIL Restorable outer ScrollEnabled ownership fixed part of try-fix-1's lifecycle problem, but still failed the vertical runtime-orientation probe: PositionLabel moved to Position: 2.
5 try-fix-4 ❌ FAIL Toggling native PanGestureRecognizer.Enabled avoided delegate replacement risk, but still failed the same vertical runtime-orientation probe and was not demonstrably better than the PR.
6 try-fix-2 ❌ FAIL Replacing/gating the outer pan recognizer delegate was fragile: after an initial compile fix, the run failed with app-running/crash symptoms. This is the riskiest failed candidate.

Key comparison points

  • Candidates that failed regression tests are ranked below candidates that passed them.
  • The raw PR fix has direct empirical support from the supplied gate result.
  • pr-plus-reviewer does not differ from pr because the expert reviewer wrote [] inline findings and recommended no code changes.
  • The STEP 5a alternatives all explored the prior vertical CarouselView2 concern, but none produced a passing, safe replacement. The best of those alternatives still failed runtime probes, so they cannot outrank the PR.

Winning candidate

Winner: pr

The PR is the single winning candidate because it is the only non-failed implementation with a real passing gate and no additional expert-review patch was available. The pr-plus-reviewer candidate is equivalent to the PR, so selecting the raw PR avoids implying a nonexistent reviewer-applied code delta.


🧭 Next Steps — review latest findings

No alternative fix was selected for this run. Review the session findings and CI results before merging.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Jul 14, 2026
@kubaflo
kubaflo changed the base branch from main to inflight/current July 14, 2026 16:32
@kubaflo
kubaflo merged commit c722ef6 into dotnet:inflight/current Jul 14, 2026
2 of 3 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR10 milestone Jul 14, 2026
kubaflo added a commit that referenced this pull request Jul 15, 2026
…6428)

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

### Issue Detail
CarouselView2 does not respect the IsSwipeEnabled setting.

### Root Cause
**iOS:**

- CarouselView2 uses UICollectionViewCompositionalLayout with
OrthogonalScrollingBehavior, which internally creates a private embedded
UIScrollView that handles paging and swipe gestures. Disabling
UICollectionView.ScrollEnabled does not affect this internal scroller.
The previous fix (PR #29996) only reapplied the swipe state when the
embedded scroller was added through AddSubview, leaving two scenarios
uncovered: the scroller could already exist before the IsSwipeEnabled
mapper executed during initial layout, or UIKit could add it through
other insertion APIs such as InsertSubview or InsertSubviewBelow.

- Additionally, disabling scrolling (ScrollEnabled = false) does not
disable rubber-band (bounce) behavior because bouncing is controlled by
the independent Bounces and AlwaysBounce properties. The embedded
scroller also ignored the existing IsBounceEnabled property and instead
tied its bounce behavior directly to the swipe state, causing
inconsistent behavior between the outer collection view and the internal
scroller.

**Android:**

MauiCarouselRecyclerView already prevented gesture interception when
IsSwipeEnabled was false by overriding OnInterceptTouchEvent. However,
Android's touch dispatch can invoke OnTouchEvent directly when a child
view does not consume the initial `ACTION_DOWN` event (for example, when
the touch begins on an empty area of the carousel). Since OnTouchEvent
did not check IsSwipeEnabled, the RecyclerView could still process the
gesture and scroll.

### Description of Change
**iOS:**

- Cache the current swipe and bounce state and reapply it whenever
subviews are added.
- Override LayoutSubviews() to reapply the cached state on every layout
pass, ensuring the embedded orthogonal scroller is updated regardless of
when or how it is created.
- Apply ScrollEnabled, Bounces, AlwaysBounceHorizontal, and
AlwaysBounceVertical consistently to both the outer UICollectionView and
the embedded orthogonal `UIScrollView`.
- Update the embedded scroller to honor the existing IsBounceEnabled
property independently of IsSwipeEnabled, matching the behavior of the
outer collection view.

**Android:**

- Added an IsSwipeEnabled check to OnTouchEvent, matching the existing
guard in OnInterceptTouchEvent, so direct touch dispatch can no longer
initiate scrolling when swipe is disabled.

### Validated the behaviour in the following platforms
- [x] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Issues Fixed:
Fixes #36267 

### Screenshots
| Before  | After |
|---------|--------|
|  <video
src="https://github.com/user-attachments/assets/2b0e8ecb-da19-4b6c-94f6-f56bbf36ae02">
|   <video
src="https://github.com/user-attachments/assets/3c23a0b2-d7f9-4962-b7b3-2aa72ce10752"> 
|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
@morning4coffe-dev

Copy link
Copy Markdown
Contributor

Performance analysis

Verdict: 🟡 Advisory regression — deliberate MacCatalyst correctness cost

Android, iOS, and MacCatalyst produced complete, provenance-validated evidence against the PR’s merge-time base.

  • Android: median touch-batch latency decreased from 70.86 ms to 14.09 ms (-80.1%), but repeated ranges overlap, so this remains neutral/advisory rather than a confirmed timing improvement. Correctness changed from 3,000 handled disabled-swipe events and final position 19 to zero handled events and position 0.
  • iOS: median forced-layout latency changed from 10.035 ms to 10.031 ms (-0.04%) with overlapping ranges. Correctness changed from 500 state-reapplication failures to zero.
  • MacCatalyst: median forced-layout latency increased from 3.74 ms to 8.93 ms (+139.1%) with non-overlapping ranges. Correctness changed from 500 state-reapplication failures to zero. This is an advisory, deliberate correctness cost of about 5.20 ms per batch of 50 forced layouts (~0.104 ms/layout in this synthetic scenario).

Execution provenance: local macOS reproduction using the perf-check trusted ABBA runner, parser, and comparator; this was not an AzDO/Helix run. Android/MacCatalyst harness: 79841d2019b29e293805d1794ff6071a76bbd9c1. iOS harness: fefa153d3ca423db5e8061541f257dda90c94d1f.

The pinned iOS base/head commits contain duplicate PublicAPI entries and historical trim diagnostics promoted to errors. The iOS build applied the same diagnostic-only compatibility profile to both variants: EnableTrimAnalyzer=false, SuppressTrimAnalysisWarnings=true, and RS0025 appended to the existing NoWarn list. Release IL stripping remained enabled.

Tradeoff assessment

  • Assessment: unclear
  • Confidence: high
  • Cost attribution: deliberate
Factor Evidence-backed assessment
Correctness benefit Established on all measured platforms. Android stopped handling disabled swipes; iOS and MacCatalyst reapplied the disabled state on every forced layout.
Absolute cost MacCatalyst +5.20 ms per 50-layout batch; iOS effectively unchanged (-0.004 ms median); Android median -56.77 ms per 100-event batch.
Relative cost MacCatalyst +139.1% with non-overlapping ranges; iOS -0.04% and Android -80.1% with overlapping ranges.
Execution frequency Android per touch event; Apple state reapplication on every LayoutSubviews pass.
Affected scope Android, iOS, and MacCatalyst accepted.
Better tested alternative Not established.
Workaround quality None validated.

Performance recommendations

Recommendation Evidence Expected direction Risk Status Tested here
Preserve the Android early return; it removes disabled-swipe handling and trends substantially faster. Handled events 3,000→0; final position 19→0; median -80.1% Avoid unnecessary touch dispatch while disabled. Low if disabled-swipe semantics remain unchanged. measured yes
On Apple, avoid traversing and rewriting embedded-scroll state when the cached native state is already correct; still reapply after UIKit recreates or mutates the embedded scroller. MauiCollectionView.LayoutSubviews; MacCatalyst +5.20 ms per 50 forced layouts; iOS neutral Reduce steady-state layout overhead while preserving the fix. An overly aggressive guard could restore the swipe/bounce bug after UIKit reconfiguration. hypothesis no
Add a second Apple scenario that does not reset UIKit state before every layout. Current scenario intentionally resets native state each iteration Separate worst-case repair cost from normal steady-state layout cost. Additional test maintenance. recommended no

Possible workaround

Status: none

No workaround was validated. Accessibility is not-assessed.

Recommended next action

Action: run_more_measurements

The iOS path is neutral. For MacCatalyst, measure both the current forced-reset scenario and a steady-state layout scenario before deciding whether the +139.1% relative increase needs optimization; the absolute measured cost is approximately 0.104 ms per forced layout.

Coverage

Evidence tier Changed files Result
Managed-measured 0 none
Managed-sampled 0 none
Device-required 3 Android, iOS, and MacCatalyst accepted
Static-only 0 none
📊 Managed benchmark deltas

None. The changed native CarouselView handler paths require device execution.

📱 Required device scenarios
Platform Base Head Median delta Range overlap Provenance / correctness
Android 17.64–262.63 ms; median 70.86 7.90–149.45 ms; median 14.09 -80.1% yes passed / passed
iOS 9.99–20.66 ms; median 10.035 3.53–20.66 ms; median 10.031 -0.04% yes passed / passed
MacCatalyst 3.54–6.37 ms; median 3.74 7.54–12.71 ms; median 8.93 +139.1% no passed / passed

Android environment: API 35 emulator (sdk_gphone64_arm64). iOS environment: arm64 iOS 26.0.1 simulator with Xcode 26.0. MacCatalyst environment: arm64 macOS 26.5. All used .NET SDK 10.0.108, ABBA order, and two results per side.

🔎 Static hot-path review

Android adds a constant-time early return before loop-centering and native touch dispatch.

Apple now calls ApplySwipeEnabledToEmbeddedScrollViews from every LayoutSubviews, traversing Subviews and assigning four scroll/bounce properties. The MacCatalyst cost is directly attributable to that repeated correctness enforcement; the equivalent iOS simulator workload remained neutral.

🤖 Automated analysis by the perf-check local run workflow.

kubaflo added a commit that referenced this pull request Jul 22, 2026
…6428)

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

### Issue Detail
CarouselView2 does not respect the IsSwipeEnabled setting.

### Root Cause
**iOS:**

- CarouselView2 uses UICollectionViewCompositionalLayout with
OrthogonalScrollingBehavior, which internally creates a private embedded
UIScrollView that handles paging and swipe gestures. Disabling
UICollectionView.ScrollEnabled does not affect this internal scroller.
The previous fix (PR #29996) only reapplied the swipe state when the
embedded scroller was added through AddSubview, leaving two scenarios
uncovered: the scroller could already exist before the IsSwipeEnabled
mapper executed during initial layout, or UIKit could add it through
other insertion APIs such as InsertSubview or InsertSubviewBelow.

- Additionally, disabling scrolling (ScrollEnabled = false) does not
disable rubber-band (bounce) behavior because bouncing is controlled by
the independent Bounces and AlwaysBounce properties. The embedded
scroller also ignored the existing IsBounceEnabled property and instead
tied its bounce behavior directly to the swipe state, causing
inconsistent behavior between the outer collection view and the internal
scroller.

**Android:**

MauiCarouselRecyclerView already prevented gesture interception when
IsSwipeEnabled was false by overriding OnInterceptTouchEvent. However,
Android's touch dispatch can invoke OnTouchEvent directly when a child
view does not consume the initial `ACTION_DOWN` event (for example, when
the touch begins on an empty area of the carousel). Since OnTouchEvent
did not check IsSwipeEnabled, the RecyclerView could still process the
gesture and scroll.

### Description of Change
**iOS:**

- Cache the current swipe and bounce state and reapply it whenever
subviews are added.
- Override LayoutSubviews() to reapply the cached state on every layout
pass, ensuring the embedded orthogonal scroller is updated regardless of
when or how it is created.
- Apply ScrollEnabled, Bounces, AlwaysBounceHorizontal, and
AlwaysBounceVertical consistently to both the outer UICollectionView and
the embedded orthogonal `UIScrollView`.
- Update the embedded scroller to honor the existing IsBounceEnabled
property independently of IsSwipeEnabled, matching the behavior of the
outer collection view.

**Android:**

- Added an IsSwipeEnabled check to OnTouchEvent, matching the existing
guard in OnInterceptTouchEvent, so direct touch dispatch can no longer
initiate scrolling when swipe is disabled.

### Validated the behaviour in the following platforms
- [x] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Issues Fixed:
Fixes #36267 

### Screenshots
| Before  | After |
|---------|--------|
|  <video
src="https://github.com/user-attachments/assets/2b0e8ecb-da19-4b6c-94f6-f56bbf36ae02">
|   <video
src="https://github.com/user-attachments/assets/3c23a0b2-d7f9-4962-b7b3-2aa72ce10752"> 
|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 28, 2026
…6428)

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

### Issue Detail
CarouselView2 does not respect the IsSwipeEnabled setting.

### Root Cause
**iOS:**

- CarouselView2 uses UICollectionViewCompositionalLayout with
OrthogonalScrollingBehavior, which internally creates a private embedded
UIScrollView that handles paging and swipe gestures. Disabling
UICollectionView.ScrollEnabled does not affect this internal scroller.
The previous fix (PR #29996) only reapplied the swipe state when the
embedded scroller was added through AddSubview, leaving two scenarios
uncovered: the scroller could already exist before the IsSwipeEnabled
mapper executed during initial layout, or UIKit could add it through
other insertion APIs such as InsertSubview or InsertSubviewBelow.

- Additionally, disabling scrolling (ScrollEnabled = false) does not
disable rubber-band (bounce) behavior because bouncing is controlled by
the independent Bounces and AlwaysBounce properties. The embedded
scroller also ignored the existing IsBounceEnabled property and instead
tied its bounce behavior directly to the swipe state, causing
inconsistent behavior between the outer collection view and the internal
scroller.

**Android:**

MauiCarouselRecyclerView already prevented gesture interception when
IsSwipeEnabled was false by overriding OnInterceptTouchEvent. However,
Android's touch dispatch can invoke OnTouchEvent directly when a child
view does not consume the initial `ACTION_DOWN` event (for example, when
the touch begins on an empty area of the carousel). Since OnTouchEvent
did not check IsSwipeEnabled, the RecyclerView could still process the
gesture and scroll.

### Description of Change
**iOS:**

- Cache the current swipe and bounce state and reapply it whenever
subviews are added.
- Override LayoutSubviews() to reapply the cached state on every layout
pass, ensuring the embedded orthogonal scroller is updated regardless of
when or how it is created.
- Apply ScrollEnabled, Bounces, AlwaysBounceHorizontal, and
AlwaysBounceVertical consistently to both the outer UICollectionView and
the embedded orthogonal `UIScrollView`.
- Update the embedded scroller to honor the existing IsBounceEnabled
property independently of IsSwipeEnabled, matching the behavior of the
outer collection view.

**Android:**

- Added an IsSwipeEnabled check to OnTouchEvent, matching the existing
guard in OnInterceptTouchEvent, so direct touch dispatch can no longer
initiate scrolling when swipe is disabled.

### Validated the behaviour in the following platforms
- [x] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Issues Fixed:
Fixes #36267 

### Screenshots
| Before  | After |
|---------|--------|
|  <video
src="https://github.com/user-attachments/assets/2b0e8ecb-da19-4b6c-94f6-f56bbf36ae02">
|   <video
src="https://github.com/user-attachments/assets/3c23a0b2-d7f9-4962-b7b3-2aa72ce10752"> 
|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Jul 29, 2026
…6428)

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

### Issue Detail
CarouselView2 does not respect the IsSwipeEnabled setting.

### Root Cause
**iOS:**

- CarouselView2 uses UICollectionViewCompositionalLayout with
OrthogonalScrollingBehavior, which internally creates a private embedded
UIScrollView that handles paging and swipe gestures. Disabling
UICollectionView.ScrollEnabled does not affect this internal scroller.
The previous fix (PR #29996) only reapplied the swipe state when the
embedded scroller was added through AddSubview, leaving two scenarios
uncovered: the scroller could already exist before the IsSwipeEnabled
mapper executed during initial layout, or UIKit could add it through
other insertion APIs such as InsertSubview or InsertSubviewBelow.

- Additionally, disabling scrolling (ScrollEnabled = false) does not
disable rubber-band (bounce) behavior because bouncing is controlled by
the independent Bounces and AlwaysBounce properties. The embedded
scroller also ignored the existing IsBounceEnabled property and instead
tied its bounce behavior directly to the swipe state, causing
inconsistent behavior between the outer collection view and the internal
scroller.

**Android:**

MauiCarouselRecyclerView already prevented gesture interception when
IsSwipeEnabled was false by overriding OnInterceptTouchEvent. However,
Android's touch dispatch can invoke OnTouchEvent directly when a child
view does not consume the initial `ACTION_DOWN` event (for example, when
the touch begins on an empty area of the carousel). Since OnTouchEvent
did not check IsSwipeEnabled, the RecyclerView could still process the
gesture and scroll.

### Description of Change
**iOS:**

- Cache the current swipe and bounce state and reapply it whenever
subviews are added.
- Override LayoutSubviews() to reapply the cached state on every layout
pass, ensuring the embedded orthogonal scroller is updated regardless of
when or how it is created.
- Apply ScrollEnabled, Bounces, AlwaysBounceHorizontal, and
AlwaysBounceVertical consistently to both the outer UICollectionView and
the embedded orthogonal `UIScrollView`.
- Update the embedded scroller to honor the existing IsBounceEnabled
property independently of IsSwipeEnabled, matching the behavior of the
outer collection view.

**Android:**

- Added an IsSwipeEnabled check to OnTouchEvent, matching the existing
guard in OnInterceptTouchEvent, so direct touch dispatch can no longer
initiate scrolling when swipe is disabled.

### Validated the behaviour in the following platforms
- [x] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Issues Fixed:
Fixes #36267 

### Screenshots
| Before  | After |
|---------|--------|
|  <video
src="https://github.com/user-attachments/assets/2b0e8ecb-da19-4b6c-94f6-f56bbf36ae02">
|   <video
src="https://github.com/user-attachments/assets/3c23a0b2-d7f9-4962-b7b3-2aa72ce10752"> 
|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Aug 7, 2026
…6428)

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

### Issue Detail
CarouselView2 does not respect the IsSwipeEnabled setting.

### Root Cause
**iOS:**

- CarouselView2 uses UICollectionViewCompositionalLayout with
OrthogonalScrollingBehavior, which internally creates a private embedded
UIScrollView that handles paging and swipe gestures. Disabling
UICollectionView.ScrollEnabled does not affect this internal scroller.
The previous fix (PR #29996) only reapplied the swipe state when the
embedded scroller was added through AddSubview, leaving two scenarios
uncovered: the scroller could already exist before the IsSwipeEnabled
mapper executed during initial layout, or UIKit could add it through
other insertion APIs such as InsertSubview or InsertSubviewBelow.

- Additionally, disabling scrolling (ScrollEnabled = false) does not
disable rubber-band (bounce) behavior because bouncing is controlled by
the independent Bounces and AlwaysBounce properties. The embedded
scroller also ignored the existing IsBounceEnabled property and instead
tied its bounce behavior directly to the swipe state, causing
inconsistent behavior between the outer collection view and the internal
scroller.

**Android:**

MauiCarouselRecyclerView already prevented gesture interception when
IsSwipeEnabled was false by overriding OnInterceptTouchEvent. However,
Android's touch dispatch can invoke OnTouchEvent directly when a child
view does not consume the initial `ACTION_DOWN` event (for example, when
the touch begins on an empty area of the carousel). Since OnTouchEvent
did not check IsSwipeEnabled, the RecyclerView could still process the
gesture and scroll.

### Description of Change
**iOS:**

- Cache the current swipe and bounce state and reapply it whenever
subviews are added.
- Override LayoutSubviews() to reapply the cached state on every layout
pass, ensuring the embedded orthogonal scroller is updated regardless of
when or how it is created.
- Apply ScrollEnabled, Bounces, AlwaysBounceHorizontal, and
AlwaysBounceVertical consistently to both the outer UICollectionView and
the embedded orthogonal `UIScrollView`.
- Update the embedded scroller to honor the existing IsBounceEnabled
property independently of IsSwipeEnabled, matching the behavior of the
outer collection view.

**Android:**

- Added an IsSwipeEnabled check to OnTouchEvent, matching the existing
guard in OnInterceptTouchEvent, so direct touch dispatch can no longer
initiate scrolling when swipe is disabled.

### Validated the behaviour in the following platforms
- [x] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Issues Fixed:
Fixes #36267 

### Screenshots
| Before  | After |
|---------|--------|
|  <video
src="https://github.com/user-attachments/assets/2b0e8ecb-da19-4b6c-94f6-f56bbf36ae02">
|   <video
src="https://github.com/user-attachments/assets/3c23a0b2-d7f9-4962-b7b3-2aa72ce10752"> 
|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
kubaflo added a commit that referenced this pull request Aug 12, 2026
…6428)

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

### Issue Detail
CarouselView2 does not respect the IsSwipeEnabled setting.

### Root Cause
**iOS:**

- CarouselView2 uses UICollectionViewCompositionalLayout with
OrthogonalScrollingBehavior, which internally creates a private embedded
UIScrollView that handles paging and swipe gestures. Disabling
UICollectionView.ScrollEnabled does not affect this internal scroller.
The previous fix (PR #29996) only reapplied the swipe state when the
embedded scroller was added through AddSubview, leaving two scenarios
uncovered: the scroller could already exist before the IsSwipeEnabled
mapper executed during initial layout, or UIKit could add it through
other insertion APIs such as InsertSubview or InsertSubviewBelow.

- Additionally, disabling scrolling (ScrollEnabled = false) does not
disable rubber-band (bounce) behavior because bouncing is controlled by
the independent Bounces and AlwaysBounce properties. The embedded
scroller also ignored the existing IsBounceEnabled property and instead
tied its bounce behavior directly to the swipe state, causing
inconsistent behavior between the outer collection view and the internal
scroller.

**Android:**

MauiCarouselRecyclerView already prevented gesture interception when
IsSwipeEnabled was false by overriding OnInterceptTouchEvent. However,
Android's touch dispatch can invoke OnTouchEvent directly when a child
view does not consume the initial `ACTION_DOWN` event (for example, when
the touch begins on an empty area of the carousel). Since OnTouchEvent
did not check IsSwipeEnabled, the RecyclerView could still process the
gesture and scroll.

### Description of Change
**iOS:**

- Cache the current swipe and bounce state and reapply it whenever
subviews are added.
- Override LayoutSubviews() to reapply the cached state on every layout
pass, ensuring the embedded orthogonal scroller is updated regardless of
when or how it is created.
- Apply ScrollEnabled, Bounces, AlwaysBounceHorizontal, and
AlwaysBounceVertical consistently to both the outer UICollectionView and
the embedded orthogonal `UIScrollView`.
- Update the embedded scroller to honor the existing IsBounceEnabled
property independently of IsSwipeEnabled, matching the behavior of the
outer collection view.

**Android:**

- Added an IsSwipeEnabled check to OnTouchEvent, matching the existing
guard in OnInterceptTouchEvent, so direct touch dispatch can no longer
initiate scrolling when swipe is disabled.

### Validated the behaviour in the following platforms
- [x] Android
- [ ] Windows
- [x] iOS
- [x] Mac

### Issues Fixed:
Fixes #36267 

### Screenshots
| Before  | After |
|---------|--------|
|  <video
src="https://github.com/user-attachments/assets/2b0e8ecb-da19-4b6c-94f6-f56bbf36ae02">
|   <video
src="https://github.com/user-attachments/assets/3c23a0b2-d7f9-4962-b7b3-2aa72ce10752"> 
|

---------

Co-authored-by: Jakub Florkowski <42434498+kubaflo@users.noreply.github.com>
@github-actions github-actions Bot locked and limited conversation to collaborators Aug 19, 2026
@sheiksyedm sheiksyedm modified the milestones: .NET 10 SR10, .NET 10 SR11 Aug 26, 2026
@sheiksyedm sheiksyedm added the community ✨ Community Contribution label Oct 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration s/agent-fix-pr-picked AI could not beat the PR fix - PR is the best among all candidates s/agent-gate-passed AI verified tests catch the bug (fail without fix, pass with fix) 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.

[iOS] IsSwipeEnabled Not Working on CarouselView (CV2)

6 participants