Skip to content

[inflight regression][iOS] Fix CarouselView2 dropping scrolls after ItemsSource swap/reset#36753

Draft
SyedAbdulAzeemSF4852 wants to merge 2 commits into
dotnet:inflight/candidatefrom
SyedAbdulAzeemSF4852:fix-36718
Draft

[inflight regression][iOS] Fix CarouselView2 dropping scrolls after ItemsSource swap/reset#36753
SyedAbdulAzeemSF4852 wants to merge 2 commits into
dotnet:inflight/candidatefrom
SyedAbdulAzeemSF4852:fix-36718

Conversation

@SyedAbdulAzeemSF4852

@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 commented Jul 23, 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 Details

Root Cause

  • PR [iOS/Mac][CV2] Fix CarouselView2 freezes with infinite loop when IsScrollAnimated=False #35848's _gotoPosition guard in CarouselViewController2 (iOS) is set by every call to ScrollToPosition and expected to be cleared by the scroll callback, but two internal scrolls — the SetValueFromRenderer(Position, 0) in UpdateItemsSource's reset branch and the forced ScrollToPosition(target, target, animated:false, forceScroll:true) at the end of CollectionViewUpdated — set it without producing a callback, so the stale value silently drops the next programmatic scroll.

Description of Change

  • Cleared _gotoPosition when updating the items source to prevent scroll targets from the old source affecting the new data.
  • Cleared _gotoPosition after resetting the Position property to ensure future programmatic changes are not suppressed.
  • Cleared _gotoPosition during teardown to avoid leftover scroll targets when the view is re-attached.
  • Cleared _gotoPosition after a forced scroll in CollectionViewUpdated to prevent suppression of later user-initiated scrolls.
  • Cleared _gotoPosition after the forced scroll in UpdateLoop() to prevent it from becoming stale when the Loop property is toggled and the previous re-centering scroll is skipped or does not generate a callback.

Issues Fixed

Fixes #36718

Validated the behaviour in the following platforms

  • Windows
  • Android
  • iOS
  • Mac

Output

TestCase Before After
VerifyCarouselScrollsToEndItemAfterReset
CarouselViewShouldScrollToRightPosition

Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
@azure-pipelines

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

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Jul 23, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @@SyedAbdulAzeemSF4852! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Jul 23, 2026
@SyedAbdulAzeemSF4852 SyedAbdulAzeemSF4852 changed the title [WIP][inflight regression][iOS] Fix CarouselView2 dropping scrolls after ItemsSource swap/reset [inflight regression][iOS] Fix CarouselView2 dropping scrolls after ItemsSource swap/reset Jul 24, 2026
@sheiksyedm

Copy link
Copy Markdown
Contributor

/azp run maui-pr-uitests , maui-pr-devicetests

@azure-pipelines

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants