Skip to content

Conversation

@Shalini-Ashokan
Copy link
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 Details

The CarouselView's current item content scrolls vertically even when the orientation is set to horizontal.

Root Cause

The bounce behavior was not properly disabled in CarouselView. Specifically, the UICollectionView’s AlwaysBounceVertical and AlwaysBounceHorizontal properties were not configured according to the CarouselView's orientation.

Description of Change

Configured the UICollectionView’s AlwaysBounceVertical and AlwaysBounceHorizontal properties based on the CarouselView's orientation to prevent unintended scrolling.

Validated the behavior in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Issues Fixed

Fixes #31361

Output ScreenShot

Before After
BeforeFix.mov
AfterFix.mov

@dotnet-policy-service dotnet-policy-service bot added community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration labels Aug 29, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@Shalini-Ashokan Shalini-Ashokan marked this pull request as ready for review September 1, 2025 06:47
Copilot AI review requested due to automatic review settings September 1, 2025 06:47
@Shalini-Ashokan Shalini-Ashokan requested a review from a team as a code owner September 1, 2025 06:47
Copy link
Contributor

Copilot AI left a comment

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 fixes a bug in CarouselView where content was unintentionally scrolling vertically even when the orientation was set to horizontal on iOS. The issue was caused by improper bounce behavior configuration in the underlying UICollectionView.

Key changes:

  • Added proper bounce direction configuration based on CarouselView orientation
  • Created UI tests to validate the fix behavior
  • Ensured bounce only occurs in the intended scroll direction

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/Controls/src/Core/Handlers/Items2/iOS/CarouselViewController2.cs Added UpdateScrollingConstraints() method to configure bounce behavior based on orientation
src/Controls/src/Core/Handlers/Items2/CarouselViewHandler2.iOS.cs Called the new constraint update method when layout changes
src/Controls/tests/TestCases.HostApp/Issues/Issue31361.cs Created UI test page that demonstrates the carousel behavior with scroll detection
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue31361.cs Added automated test to verify vertical scrolling is prevented in horizontal CarouselView

Comment on lines 52 to 58
carouselView.Scrolled += (s, e) =>
{
if (e.VerticalDelta < 0)
{
contentLabel.Text = "The content is scrollable";
}
};
Copy link

Copilot AI Sep 1, 2025

Choose a reason for hiding this comment

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

The scroll detection logic only checks for VerticalDelta < 0 (upward scrolling), but vertical scrolling in either direction should indicate the bug is present. This should check e.VerticalDelta != 0 to detect any vertical movement.

Copilot uses AI. Check for mistakes.
@sheiksyedm sheiksyedm added platform/ios area-controls-collectionview CollectionView, CarouselView, IndicatorView collectionview-cv2 labels Sep 1, 2025
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen PureWeen added this to the .NET 10 SR1 milestone Oct 8, 2025
@PureWeen PureWeen moved this from Todo to Ready To Review in MAUI SDK Ongoing Oct 8, 2025
@PureWeen PureWeen added the p/0 Current heighest priority issues that we are targeting for a release. label Oct 10, 2025
@github-project-automation github-project-automation bot moved this from Ready To Review to Approved in MAUI SDK Ongoing Oct 23, 2025
@PureWeen PureWeen changed the base branch from main to inflight/candidate October 31, 2025 20:31
@PureWeen PureWeen merged commit 8201444 into dotnet:inflight/candidate Oct 31, 2025
128 of 130 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in MAUI SDK Ongoing Oct 31, 2025
github-actions bot pushed a commit that referenced this pull request Nov 4, 2025
…tal (#31395)

* Fix the vertical scrolling issue

* Modified the logics

* Added test case

* modified the test case

* Modified the test case

* modified the test case

* Added test case for vertical orientation

* Added test cases
@github-actions github-actions bot locked and limited conversation to collaborators Dec 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView collectionview-cv2 community ✨ Community Contribution p/0 Current heighest priority issues that we are targeting for a release. partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[iOS] CarouselViewHandler2 - Content is scrolling vertically

4 participants