Skip to content

[iOS] Fix vertical CarouselView Position synchronization - #39377

Merged
kubaflo merged 2 commits into
dotnet:inflight/currentfrom
SubhikshaSf4851:Fix-39371
Oct 15, 2026
Merged

kubaflo merged 2 commits into
dotnet:inflight/currentfrom
SubhikshaSf4851:Fix-39371

Conversation

@SubhikshaSf4851

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!

Root cause

In iOS CarouselView vertical scroll, the native scroll offset was divided by the container width instead of its height. This produced a fractional page value, preventing SetPosition from updating Position and raising PositionChanged after manual scrolling.

Description of change

A shared containerSize value is used that selects the appropriate container dimension for the active scroll axis:

  • horizontal CarouselView: offset.X and container width;
  • vertical CarouselView: offset.Y and container height.

The effective item size now derives from containerSize, allowing a vertically snapped item to resolve to its correct integer page and update Position through the existing SetPosition path.

Issues Fixed

Fixes #39371

Tested the behavior in the following platforms

  • Windows
  • Android
  • iOS
  • Mac
Before Issue Fix After Issue Fix
BeforeFix39371.mov
AfterFix39371.mov

@github-actions

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

Or

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

@dotnet-policy-service dotnet-policy-service Bot added the community ✨ Community Contribution label Oct 14, 2026
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Hey there @@SubhikshaSf4851! 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 Oct 14, 2026
@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.

@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 Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Note

🔍 /review started

AzDO build 15682646 is running for ios.

The s/agent-review-in-progress label stays on this PR through the full pipeline. The final AI Summary and outcome labels are posted only after Gate, expert review, and Deep UI tests finish.

@kubaflo

kubaflo commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines

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

@SubhikshaSf4851 SubhikshaSf4851 changed the title [WIP][iOS] Fix vertical CarouselView Position synchronization [iOS] Fix vertical CarouselView Position synchronization Oct 14, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review October 14, 2026 12:05
Copilot AI balanced review requested due to automatic review settings October 14, 2026 12:05

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.

🟡 Changes recommended

The regression test uses programmatic ScrollTo instead of reproducing the reported native swipe path.

1 open finding
What changed in this PR

Fixes vertical CarouselView position synchronization on iOS by calculating page offsets using the active scroll-axis dimension.

Changes:

  • Uses container height for vertical page calculations.
  • Adds a HostApp regression scenario.
  • Adds UI assertions for Position and PositionChanged.
File Description
LayoutFactory2.cs Calculates effective item size from the active axis.
Issue39371.cs (HostApp) Adds the vertical CarouselView test page.
Issue39371.cs (UI test) Validates position synchronization after scrolling.

🧠 Review effort: Balanced

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

MauiBot

This comment was marked as outdated.

@MauiBot MauiBot added s/agent-changes-requested AI agent recommends changes - found a better alternative or issues 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) labels Oct 14, 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 Oct 15, 2026
@kubaflo

This comment has been minimized.

@kubaflo

This comment has been minimized.

kubaflo added a commit that referenced this pull request Oct 15, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

<!--
!!!!!!! MAIN IS THE ONLY ACTIVE BRANCH. MAKE SURE THIS PR IS TARGETING
MAIN. !!!!!!!
-->

### Description of Change

<!-- Enter description of the fix in this section -->

Add a dedicated issue-comment workflow that minimizes standalone `/azp
run` commands, including named-pipeline variants, and success-only
acknowledgments from `azure-pipelines[bot]` as resolved on MAUI pull
requests.

Comments remain expandable. Failures, authorization notices, mixed
success/warning responses, and ordinary discussion remain visible. The
workflow re-reads comments before classification, checks out no PR code,
and does not change pipeline dispatch or authorization.

Document the behavior and activation boundary: after merging into the
default branch, cleanup applies to newly created or edited comments, not
historical comments.

Validation:
- `actionlint .github/workflows/azure-pipelines-comment-cleanup.yml` —
passed.
- `git diff --check` — passed.
- Embedded workflow JavaScript syntax check using Node.js
`AsyncFunction` — passed.
- Live GitHub Actions execution was not run; the new `issue_comment`
workflow requires the default branch to contain it.

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

No linked issue. Addresses comment noise exemplified by
#39377 (comment); does
not modify that PR's product code.

<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9da04e32-247a-4969-b4a9-05e872b0763d
@github-actions

Copy link
Copy Markdown
Contributor

Tests Failure Analysis

@SubhikshaSf4851 — test-failure analysis for commit ec0afe7.

Scope CI failures Commit ec0afe7


🧪 CI Analysis — click to expand
📊 maui-pr

No failures found.


🧪 maui-pr-devicetests

🧪 maui-pr-uitests

🧭 Follow-up — actions and refresh

Next action: Restore complete UI evidence; inspect the Android crash and compare unresolved cases with identical runtime/setup.

Maintainers: comment /review tests to refresh this report.

@github-actions github-actions Bot 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.

Expert Review — 0 findings

Reviewed commit ec0afe7.

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


[Test]
[Category(UITestCategories.CarouselView)]
public void ScrollToUpdatesPositionAndRaisesPositionChanged()

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)

[moderate] Regression Prevention and Test Coverage — The regression test validates only the programmatic ScrollTo path (App.Tap("ScrollToNextButton")) instead of reproducing the reported native vertical swipe scenario. Concrete failure mode: a future iOS Items2 change can break gesture-driven Position/PositionChanged updates while this test remains green because button-triggered ScrollTo still updates the labels.

@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

@SubhikshaSf4851 — new AI review results are available based on commit ec0afe7.

Gate Passed Confidence Medium Platform iOS


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

Gate Result: ✅ PASSED

Platform: IOS · Base: main · Merge base: 51cf98f2

Test Without Fix (expect FAIL) With Fix (expect PASS)
🖥️ Issue39371 Issue39371 ✅ FAIL — 441s ✅ PASS — 128s
🔴 Without fix — 🖥️ Issue39371: FAIL ✅ · 441s

Error-relevant lines (filtered from the build log):

     at Microsoft.Maui.TestCases.Tests.Issues.Issue39371.<ScrollToUpdatesPositionAndRaisesPositionChanged>b__3_0() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39371.cs:line 26
   at UITest.Appium.HelperExtensions.RetryAssert(IApp app, Action assertToRetry, Nullable`1 timeout, Nullable`1 retryFrequency) in /_/src/TestUtils/src/UITest.Appium/HelperExtensions.cs:line 998
   at Microsoft.Maui.TestCases.Tests.Issues.Issue39371.ScrollToUpdatesPositionAndRaisesPositionChanged() in /_/src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39371.cs:line 24
🟢 With fix — 🖥️ Issue39371: PASS ✅ · 128s

(no coded error found; showing last 1200 chars)

t...
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.13)
[xUnit.net 00:00:00.07]   Discovering: Controls.TestCases.iOS.Tests
[xUnit.net 00:00:00.21]   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 1 of 1 NUnit test cases using Current Discovery mode, Non-Explicit run
>>>>> 10/15/2026 5:50:25 AM FixtureSetup for Issue39371(iOS)
>>>>> 10/15/2026 5:50:34 AM ScrollToUpdatesPositionAndRaisesPositionChanged Start
>>>>> 10/15/2026 5:50:35 AM ScrollToUpdatesPositionAndRaisesPositionChanged Stop
  Passed ScrollToUpdatesPositionAndRaisesPositionChanged [1 s]
NUnit Adapter 4.5.0.0: Test execution complete
Results File: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue39371.trx
Test Run Successful.
Total tests: 1
     Passed: 1
 Total time: 32.7208 Seconds
>>> TRX_RESULT_FILE: /Users/cloudtest/vss/_work/1/s/CustomAgentLogsTmp/UITests/TestResults/Issue39371.trx
📁 Fix files reverted (1 files)
  • src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs

📋 Pre-Flight — Context & Validation

Pre-Flight Context

Reported problem

PR #39377 targets #39371. The issue reports that an iOS CollectionView 2 CarouselView configured vertically with Loop="False", MandatorySingle snap points, and centered alignment visually scrolls and snaps after a native swipe, but:

  • CarouselView.Position remains stale.
  • PositionChanged is not raised.
  • The equivalent horizontal configuration works.

The report identifies .NET MAUI 10.0.110; a follow-up states reproduction on 10.0.0 and 10.0.110 and says the issue was not reproduced with CollectionView 1. The affected iOS version, regression origin, and last known working MAUI version are unknown.

Submitted change

The immutable diff contains three files:

File Purpose
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs Corrects page-size calculation in the iOS CollectionView 2 carousel layout callback.
src/Controls/tests/TestCases.HostApp/Issues/Issue39371.cs Adds a vertical, two-item reproduction page with observable Position and PositionChanged labels.
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39371.cs Adds an Appium regression test that programmatically scrolls to item 1 and checks both labels.

The production code is inside NSCollectionLayoutSection.VisibleItemsInvalidationHandler. Before the change, the callback selected offset.X or offset.Y according to orientation but always divided that offset by a size derived from the container width. The patch instead chooses the container dimension on the active axis:

  • Horizontal: offset.X and container width.
  • Vertical: offset.Y and container height.

It then subtracts the section margins, adds ItemSpacing, and derives the page index from that effective item size. The existing callback returns without updating state when the calculated page is not effectively an integer, the item source is empty, the controller is updating, or rotation is in progress.

When a page is accepted, the existing CarouselViewController2.SetPosition path:

  • Resolves any pending programmatic _gotoPosition.
  • Sets CarouselView.PositionProperty through SetValueFromRenderer.
  • Updates CurrentItem.
  • Updates visual states.

CarouselViewDelegator2 separately tracks scrolling, dragging, animation completion, and deceleration; it does not itself assign Position. Position synchronization therefore depends on the layout invalidation callback reaching SetPosition.

Regression test path

The new host page uses:

  • A vertical CarouselView with a 300-point height.
  • Two items.
  • Loop = false.
  • MandatorySingle and centered snap alignment.
  • A button that calls ScrollTo(1, Center, animate: false).
  • Labels updated from PositionChanged.

The UI test taps that button and retries until both labels report position 1. This is a programmatic ScrollTo path, while the issue’s documented reproduction uses a native vertical swipe.

Two resolved review threads recorded this distinction. The contributor replied that ScrollTo also reproduces the defect. The supplied Gate result provides concrete evidence that the submitted test fails without the production fix and passes with it, but it does not by itself establish native-gesture coverage. Existing test Issue33308 demonstrates the repository’s gesture approach using App.ScrollDown(..., ScrollStrategy.Gesture, ...).

Platform-sensitive paths

  • The production change is under Handlers/Items2/iOS; it does not modify CollectionView 1.
  • The vertical and horizontal paths share this callback. Horizontal behavior still selects width, while vertical behavior changes to height.
  • ItemSpacing, section/peek margins, looping correction, pending programmatic positions, and rotation guards all interact with the page calculation.
  • The reported configuration has Loop = false, although the callback also serves looping carousels.
  • Required testing platform: iOS.
  • The host issue is marked PlatformAffected.iOS, and the PR description records only iOS as tested.
  • Whether this source is also compiled or behaviorally affected on Mac Catalyst was not established from the gathered context.

Validation context and requirements

Available evidence:

  • Gate: passed — the regression test fails without the fix and passes with it. It must not be rerun for this experiment.
  • The issue was independently marked reproduced on iOS with CollectionView 2.
  • The PR description claims before/after iOS testing and links videos; those attachments were not independently evaluated here.
  • CI pipelines were requested in PR comments, but their final results are unknown from the gathered context.

Relevant behavior for later iOS validation includes:

  • Vertical native swipe and snap update Position and raise PositionChanged.
  • Programmatic non-animated ScrollTo reaches the same managed state.
  • Horizontal synchronization remains unchanged.
  • Visual snapping remains correct while managed state updates.
  • Non-square containers exercise the corrected width-versus-height distinction.
  • Item spacing and peek/section margins continue to produce integral page calculations.
  • Looping, rotation, and CurrentItem behavior are adjacent paths, though not part of the reported Loop=false scenario.

Remaining uncertainties

  • Native swipe behavior is not directly exercised by the submitted regression test.
  • The exact affected iOS versions and whether Mac Catalyst is affected are unknown.
  • Regression status and the last known working MAUI release are unknown.
  • Coverage of spacing, peek areas, looping, rotation, animated scrolling, and differing item/container dimensions is not shown.
  • The precise handler-selection configuration used by the test infrastructure was not inspected; the supplied Gate result nevertheless demonstrates that this test distinguishes the submitted production change.
  • Full CI, device-test, and deep-UI-test outcomes are unknown.
  • PR #39377 remains open against main (f16eb7980531458370d47585f94719ad74e45708) with submitted head ec0afe7a832d78ee623242512da8747354d743f3. Its blocked merge state is metadata only and is not a merge-readiness conclusion.

This is scoped pre-flight context, not an exhaustive code review or comparative recommendation.


🔬 Code Review — Deep Analysis

Code Review — PR #39377

Independent Assessment

What this changes: The iOS/MacCatalyst Items2 carousel layout callback now divides the active-axis scroll offset by the active-axis container size. Horizontal carousels continue to use width; vertical carousels use height. The PR also adds an iOS UI-test page and an Appium test that invokes non-animated ScrollTo(1) and observes Position and PositionChanged.

Inferred motivation: A non-square vertical carousel previously combined offset.Y with container width, producing a fractional page that was rejected before CarouselViewController2.SetPosition could synchronize managed state.

Reconciliation with Submitted Context

The production change matches the reported width-versus-height root cause, stays in the active iOS/MacCatalyst Items2 handler, and leaves the horizontal calculation unchanged. The trusted Gate establishes that the submitted programmatic-scroll test fails without the production change and passes with it. It does not establish that the test exercises the reported native-swipe interaction.

Findings

❌ Error — Regression test does not reproduce the reported native vertical swipe

src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue39371.cs:19 taps a button whose handler calls ScrollTo(1, Center, animate: false). The issue scenario is a user swipe followed by native snapping. Those paths converge on some of the same position code, but they are not equivalent regression coverage: gesture/deceleration or snap integration can regress while programmatic ScrollTo remains green. The test should drive the vertical carousel with the repository's gesture scroll API and assert that both Position and PositionChanged reach 1.

Blast Radius Assessment

  • Runs for all instances: the changed invalidation callback serves all CarouselView instances using the iOS/MacCatalyst Items2 compositional layout; the changed dimension is selected only by orientation.
  • Startup impact: none.
  • Static/shared state: none.
  • Adjacent behavior: horizontal paging, vertical spacing and peek margins, loop correction, rotation guards, CurrentItem, and both programmatic and gesture-driven scrolling share this callback.

Failure-Mode Probing

  • Non-square vertical container: the corrected calculation uses height for both the vertical offset scale and effective item size, allowing an integral page to reach SetPosition.
  • Horizontal carousel: the calculation still uses width and preserves the prior behavior.
  • Native gesture versus programmatic scroll: the submitted test covers only programmatic scrolling, leaving the original gesture/deceleration path unprotected.
  • Empty or invalid geometry: existing item-count and non-positive-size guards remain in place.

External Output Contract

Not applicable.

Verdict: NEEDS_CHANGES

Confidence: medium
Summary: The production correction is localized and mechanically consistent with the active scroll axis, and Gate evidence validates the programmatic path. The regression test does not reproduce the issue's native-swipe scenario, so the submitted PR still lacks direct protection for the behavior it claims to fix.


🛠️ Try-Fix — Analysis & Comparison

Alternative generation: not requested

Evidence-first mode intentionally omits routine Try-Fix attempts. This is not a failed
attempt, a completed alternative search, or evidence that alternatives have no value.
The expert review may still produce one evidence-backed PR refinement.


🏁 Report — Final Recommendation

⚠️ Final Recommendation: REQUEST CHANGES

Phase Status

Phase Status Notes
Pre-Flight ✅ COMPLETE Trusted evidence-first context consumed
Expert Code Review NEEDS_CHANGES (medium) 1 blocking test-coverage finding
Gate ✅ PASSED iOS; submitted test fails without the production fix and passes with it
Try-Fix NOT REQUESTED Evidence-first mode intentionally omitted alternative generation
Refinement ✅ PASSED One evidence-backed pr-plus-reviewer refinement; focused iOS UI test passed
Report ✅ COMPLETE Compared the two real candidates only

Code Review and Candidate Comparison

Candidate Production fix Regression evidence Expert finding Rank
pr Corrects vertical page-size calculation while preserving the horizontal width path Trusted Gate passed for programmatic ScrollTo Unresolved: test does not reproduce the reported native swipe 2
pr-plus-reviewer Same submitted production fix Native gesture test passed on iOS in the isolated candidate worktree Addressed by driving ScrollStrategy.Gesture and retaining the Position/PositionChanged assertions 1

Selected Fix: pr-plus-reviewer. It is the only candidate that directly exercises the reported native-swipe path, and its one permitted focused validation passed. The submitted PR still requires that test refinement, so approval is vetoed even though the production correction and trusted Gate evidence are sound.

The trusted Gate was not rerun, as required. Consequently, the refined gesture test was validated with the fix but was not separately executed against the broken baseline; this remaining evidence limitation is recorded rather than treated as a pass.

Summary

The submitted axis-size correction is localized, uses height for vertical scrolling and width for horizontal scrolling, and reaches the existing SetPosition synchronization path. Expert review found no production-code defect, but it found that the submitted UI test uses programmatic scrolling instead of the issue's native gesture. The validated refinement corrects that mismatch.

Root Cause

The iOS/MacCatalyst Items2 layout callback used offset.Y for a vertical carousel but divided it by an effective size derived from container width. In a non-square container this yielded a fractional page, causing the callback to return before updating Position and raising PositionChanged.

Fix Quality

The production change is small, axis-consistent, and preserves existing guards for invalid geometry, empty sources, updates, and rotation. The refined test uses the repository's established gesture-scroll API and verifies both managed-state signals after native snapping. Because this improvement is not present in submitted PR HEAD, the PR requires changes.


📱 UI Tests — CarouselView,CollectionView

Detected UI test categories: CarouselView,CollectionView

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

🧪 UI Test Execution Results (deep, platform pool)

Category Tests Snapshot diffs
CarouselView 101/105 (4 skipped) ✓ —
CollectionView 431/436 (5 skipped) ✓ —
📎 Download drop-deep-uitests artifact (TRX + snapshot diffs)

🧭 Next Steps — reviewer changes required

The reviewer-enhanced candidate identified changes that are not yet in the submitted PR.

Why: The submitted production fix is sound, but its test does not reproduce the reported native-swipe path. The pr-plus-reviewer refinement directly exercises that gesture and passed the isolated focused iOS validation, so it is the stronger candidate and must be incorporated into the PR.

Address the actionable findings in this review before merging.

@MauiBot MauiBot removed the s/agent-review-in-progress AI review is currently running for this PR label Oct 15, 2026
@kubaflo
kubaflo changed the base branch from main to inflight/current October 15, 2026 15:58
@kubaflo
kubaflo merged commit 7e1f637 into dotnet:inflight/current Oct 15, 2026
193 of 213 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR12 milestone Oct 15, 2026
kubaflo pushed a commit that referenced this pull request Oct 18, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

#### Root cause

In iOS `CarouselView` vertical scroll, the native scroll offset was
divided by the container `width` instead of its `height`. This produced
a fractional page value, preventing `SetPosition` from updating
`Position` and raising `PositionChanged` after manual scrolling.

#### Description of change

A shared `containerSize` value is used that selects the appropriate
container dimension for the active scroll axis:

- horizontal CarouselView: `offset.X` and container width;
- vertical CarouselView: `offset.Y` and container height.

The effective item size now derives from `containerSize`, allowing a
vertically snapped item to resolve to its correct integer page and
update `Position` through the existing `SetPosition` path.


<!-- Enter description of the fix in this section -->

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39371 
### Tested the behavior in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [ ] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/35aaca5b-28d4-4f6b-ba7d-c91c287c546a">
| <video
src="https://github.com/user-attachments/assets/4cd53a07-4c3e-4a76-9f12-dbea49d075da">
|
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Oct 21, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

#### Root cause

In iOS `CarouselView` vertical scroll, the native scroll offset was
divided by the container `width` instead of its `height`. This produced
a fractional page value, preventing `SetPosition` from updating
`Position` and raising `PositionChanged` after manual scrolling.

#### Description of change

A shared `containerSize` value is used that selects the appropriate
container dimension for the active scroll axis:

- horizontal CarouselView: `offset.X` and container width;
- vertical CarouselView: `offset.Y` and container height.

The effective item size now derives from `containerSize`, allowing a
vertically snapped item to resolve to its correct integer page and
update `Position` through the existing `SetPosition` path.


<!-- Enter description of the fix in this section -->

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39371 
### Tested the behavior in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [ ] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/35aaca5b-28d4-4f6b-ba7d-c91c287c546a">
| <video
src="https://github.com/user-attachments/assets/4cd53a07-4c3e-4a76-9f12-dbea49d075da">
|
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
@MichaelShapiro

Copy link
Copy Markdown

@kubaflo Thank you for the fix of the original #39371 issue. Not sure if I am tracking this right but is this fix included in 10.0.120 release?

@kubaflo

kubaflo commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

It will be in sr1 net11

@Kapusch

Kapusch commented Oct 25, 2026

Copy link
Copy Markdown

Hi @kubaflo & Team, thanks a lot for the fix!

Could you confirm whether it will also ship in a .NET 10 service release (e.g. 10.0.130)?
Moving to .NET 11 isn't possible for us right now because of its minimum Xcode requirement, and this vertical CarouselView issue has been around for quite a while. Thanks for your understanding.

@kubaflo

kubaflo commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

@Kapusch yea, I will include it in sr13

kubaflo pushed a commit that referenced this pull request Oct 25, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

#### Root cause

In iOS `CarouselView` vertical scroll, the native scroll offset was
divided by the container `width` instead of its `height`. This produced
a fractional page value, preventing `SetPosition` from updating
`Position` and raising `PositionChanged` after manual scrolling.

#### Description of change

A shared `containerSize` value is used that selects the appropriate
container dimension for the active scroll axis:

- horizontal CarouselView: `offset.X` and container width;
- vertical CarouselView: `offset.Y` and container height.

The effective item size now derives from `containerSize`, allowing a
vertically snapped item to resolve to its correct integer page and
update `Position` through the existing `SetPosition` path.


<!-- Enter description of the fix in this section -->

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39371 
### Tested the behavior in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [ ] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/35aaca5b-28d4-4f6b-ba7d-c91c287c546a">
| <video
src="https://github.com/user-attachments/assets/4cd53a07-4c3e-4a76-9f12-dbea49d075da">
|
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
kubaflo pushed a commit that referenced this pull request Oct 26, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

#### Root cause

In iOS `CarouselView` vertical scroll, the native scroll offset was
divided by the container `width` instead of its `height`. This produced
a fractional page value, preventing `SetPosition` from updating
`Position` and raising `PositionChanged` after manual scrolling.

#### Description of change

A shared `containerSize` value is used that selects the appropriate
container dimension for the active scroll axis:

- horizontal CarouselView: `offset.X` and container width;
- vertical CarouselView: `offset.Y` and container height.

The effective item size now derives from `containerSize`, allowing a
vertically snapped item to resolve to its correct integer page and
update `Position` through the existing `SetPosition` path.


<!-- Enter description of the fix in this section -->

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39371 
### Tested the behavior in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [ ] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/35aaca5b-28d4-4f6b-ba7d-c91c287c546a">
| <video
src="https://github.com/user-attachments/assets/4cd53a07-4c3e-4a76-9f12-dbea49d075da">
|
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->
github-actions Bot pushed a commit that referenced this pull request Oct 28, 2026
<!-- Please let the below note in for people that find this PR -->
> [!NOTE]
> Are you waiting for the changes in this PR to be merged?
> It would be very helpful if you could [test the resulting
artifacts](https://github.com/dotnet/maui/wiki/Testing-PR-Builds) from
this PR and let us know in a comment if this change resolves your issue.
Thank you!

#### Root cause

In iOS `CarouselView` vertical scroll, the native scroll offset was
divided by the container `width` instead of its `height`. This produced
a fractional page value, preventing `SetPosition` from updating
`Position` and raising `PositionChanged` after manual scrolling.

#### Description of change

A shared `containerSize` value is used that selects the appropriate
container dimension for the active scroll axis:

- horizontal CarouselView: `offset.X` and container width;
- vertical CarouselView: `offset.Y` and container height.

The effective item size now derives from `containerSize`, allowing a
vertically snapped item to resolve to its correct integer page and
update `Position` through the existing `SetPosition` path.


<!-- Enter description of the fix in this section -->

### Issues Fixed

<!-- Please make sure that there is a bug logged for the issue being
fixed. The bug should describe the problem and how to reproduce it. -->

Fixes #39371 
### Tested the behavior in the following platforms

- [ ] Windows
- [ ] Android
- [x] iOS
- [ ] Mac

| Before Issue Fix | After Issue Fix |
|----------|----------|
| <video
src="https://github.com/user-attachments/assets/35aaca5b-28d4-4f6b-ba7d-c91c287c546a">
| <video
src="https://github.com/user-attachments/assets/4cd53a07-4c3e-4a76-9f12-dbea49d075da">
|
<!--
Are you targeting main? All PRs should target the main branch unless
otherwise noted.
-->

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — ec0afe7a Deployed Oct 14, 2026 by SubhikshaSf4851 via conclusion #2346
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios s/agent-changes-requested AI agent recommends changes - found a better alternative or issues 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] Vertical CarouselView scrolls and snaps but fails to update Position or raise PositionChanged (Loop=False)

7 participants