Skip to content

Fix ScrollToPosition.Center behavior in ScrollView on iOS and MacCatalyst#26825

Merged
PureWeen merged 10 commits intodotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-26760
Dec 16, 2025
Merged

Fix ScrollToPosition.Center behavior in ScrollView on iOS and MacCatalyst#26825
PureWeen merged 10 commits intodotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-26760

Conversation

@devanathan-vaithiyanathan
Copy link
Contributor

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Dec 26, 2024

Issue Details

When scrolling a ScrollView using the ScrollToAsync method with the ScrollPosition.Center value, the item is incorrectly centered.

Root Cause

The scroll offset values allow items to scroll into a negative position, causing the item to be incorrectly centered.

Description of Change

We clamp the scroll offset values to ensure the item does not scroll into a negative position.

Issues Fixed

Fixes #26760
Fixes #28965

Validated the behaviour in the following platforms

  • Android
  • Windows
  • iOS
  • Mac

Output Screenshot

Before After
BeforeFix-IOS.mp4
AfterFix-IOS.mp4

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Dec 26, 2024
@karthikraja-arumugam karthikraja-arumugam added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Dec 27, 2024
@MartyIX MartyIX added platform/macos macOS / Mac Catalyst platform/ios labels Dec 29, 2024
@devanathan-vaithiyanathan devanathan-vaithiyanathan marked this pull request as ready for review January 2, 2025 09:34
@devanathan-vaithiyanathan devanathan-vaithiyanathan requested a review from a team as a code owner January 2, 2025 09:34
@Redth
Copy link
Member

Redth commented Jan 2, 2025

/azp run

@azure-pipelines

This comment was marked as off-topic.

2 similar comments
@azure-pipelines

This comment was marked as outdated.

@azure-pipelines

This comment was marked as outdated.

@jsuarezruiz

This comment was marked as off-topic.

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Copy link
Contributor

@jsuarezruiz jsuarezruiz left a comment

Choose a reason for hiding this comment

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

The test ScrollToElement3End fails with small changes on Mac and iOS:
image

Could you review it and see if is related with the changes?

@Shalini-Ashokan
Copy link
Contributor

The test ScrollToElement3End fails with small changes on Mac and iOS: image

Could you review it and see if is related with the changes?

@jsuarezruiz, Yes, the test failure is related to my changes, and the snapshot has a slight difference. Shall I commit the newly generated image?

@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

The test ScrollToElement3End fails with small changes on Mac and iOS: image
Could you review it and see if is related with the changes?

@jsuarezruiz, Yes, the test failure is related to my changes, and the snapshot has a slight difference. Shall I commit the newly generated image?

Yes, thanks in advance.

@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@rmarinho
Copy link
Member

/rebase

@rmarinho
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

/rebase

@jsuarezruiz
Copy link
Contributor

/azp run

Copilot AI review requested due to automatic review settings August 27, 2025 10:08
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@jfversluis
Copy link
Member

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@PureWeen PureWeen dismissed their stale review December 16, 2025 20:54

changes made

@PureWeen PureWeen changed the base branch from main to inflight/current December 16, 2025 20:54
@PureWeen PureWeen merged commit cb76354 into dotnet:inflight/current Dec 16, 2025
175 of 184 checks passed
PureWeen pushed a commit that referenced this pull request Dec 16, 2025
…lyst (#26825)

### Issue Details
When scrolling a ScrollView using the ScrollToAsync method with the
ScrollPosition.Center value, the item is incorrectly centered.

### Root Cause
The scroll offset values allow items to scroll into a negative position,
causing the item to be incorrectly centered.
 
### Description of Change
We clamp the scroll offset values to ensure the item does not scroll
into a negative position.

### 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 #26760 
Fixes #28965 

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

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

### Output Screenshot
| Before  | After  |
|---------|--------|
| <video
src="https://github.com/user-attachments/assets/be05f838-42bf-452c-bc1a-a34d02de006f"
width="320" height="240" controls></video> | <video
src="https://github.com/user-attachments/assets/02ca23f1-0d31-49c5-9862-767235845761"
width="320" height="240" controls></video> |

---------

Co-authored-by: Shalini-Ashokan <102292178+Shalini-Ashokan@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Dec 22, 2025
…lyst (#26825)

### Issue Details
When scrolling a ScrollView using the ScrollToAsync method with the
ScrollPosition.Center value, the item is incorrectly centered.

### Root Cause
The scroll offset values allow items to scroll into a negative position,
causing the item to be incorrectly centered.
 
### Description of Change
We clamp the scroll offset values to ensure the item does not scroll
into a negative position.

### 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 #26760 
Fixes #28965 

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

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

### Output Screenshot
| Before  | After  |
|---------|--------|
| <video
src="https://github.com/user-attachments/assets/be05f838-42bf-452c-bc1a-a34d02de006f"
width="320" height="240" controls></video> | <video
src="https://github.com/user-attachments/assets/02ca23f1-0d31-49c5-9862-767235845761"
width="320" height="240" controls></video> |

---------

Co-authored-by: Shalini-Ashokan <102292178+Shalini-Ashokan@users.noreply.github.com>
PureWeen pushed a commit that referenced this pull request Dec 22, 2025
…lyst (#26825)

### Issue Details
When scrolling a ScrollView using the ScrollToAsync method with the
ScrollPosition.Center value, the item is incorrectly centered.

### Root Cause
The scroll offset values allow items to scroll into a negative position,
causing the item to be incorrectly centered.
 
### Description of Change
We clamp the scroll offset values to ensure the item does not scroll
into a negative position.

### 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 #26760 
Fixes #28965 

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

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

### Output Screenshot
| Before  | After  |
|---------|--------|
| <video
src="https://github.com/user-attachments/assets/be05f838-42bf-452c-bc1a-a34d02de006f"
width="320" height="240" controls></video> | <video
src="https://github.com/user-attachments/assets/02ca23f1-0d31-49c5-9862-767235845761"
width="320" height="240" controls></video> |

---------

Co-authored-by: Shalini-Ashokan <102292178+Shalini-Ashokan@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Dec 24, 2025
…lyst (#26825)

### Issue Details
When scrolling a ScrollView using the ScrollToAsync method with the
ScrollPosition.Center value, the item is incorrectly centered.

### Root Cause
The scroll offset values allow items to scroll into a negative position,
causing the item to be incorrectly centered.
 
### Description of Change
We clamp the scroll offset values to ensure the item does not scroll
into a negative position.

### 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 #26760 
Fixes #28965 

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

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

### Output Screenshot
| Before  | After  |
|---------|--------|
| <video
src="https://github.com/user-attachments/assets/be05f838-42bf-452c-bc1a-a34d02de006f"
width="320" height="240" controls></video> | <video
src="https://github.com/user-attachments/assets/02ca23f1-0d31-49c5-9862-767235845761"
width="320" height="240" controls></video> |

---------

Co-authored-by: Shalini-Ashokan <102292178+Shalini-Ashokan@users.noreply.github.com>
PureWeen pushed a commit that referenced this pull request Dec 26, 2025
…lyst (#26825)

### Issue Details
When scrolling a ScrollView using the ScrollToAsync method with the
ScrollPosition.Center value, the item is incorrectly centered.

### Root Cause
The scroll offset values allow items to scroll into a negative position,
causing the item to be incorrectly centered.
 
### Description of Change
We clamp the scroll offset values to ensure the item does not scroll
into a negative position.

### 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 #26760 
Fixes #28965 

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

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

### Output Screenshot
| Before  | After  |
|---------|--------|
| <video
src="https://github.com/user-attachments/assets/be05f838-42bf-452c-bc1a-a34d02de006f"
width="320" height="240" controls></video> | <video
src="https://github.com/user-attachments/assets/02ca23f1-0d31-49c5-9862-767235845761"
width="320" height="240" controls></video> |

---------

Co-authored-by: Shalini-Ashokan <102292178+Shalini-Ashokan@users.noreply.github.com>
github-actions bot pushed a commit that referenced this pull request Dec 27, 2025
…lyst (#26825)

### Issue Details
When scrolling a ScrollView using the ScrollToAsync method with the
ScrollPosition.Center value, the item is incorrectly centered.

### Root Cause
The scroll offset values allow items to scroll into a negative position,
causing the item to be incorrectly centered.
 
### Description of Change
We clamp the scroll offset values to ensure the item does not scroll
into a negative position.

### 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 #26760 
Fixes #28965 

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

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

### Output Screenshot
| Before  | After  |
|---------|--------|
| <video
src="https://github.com/user-attachments/assets/be05f838-42bf-452c-bc1a-a34d02de006f"
width="320" height="240" controls></video> | <video
src="https://github.com/user-attachments/assets/02ca23f1-0d31-49c5-9862-767235845761"
width="320" height="240" controls></video> |

---------

Co-authored-by: Shalini-Ashokan <102292178+Shalini-Ashokan@users.noreply.github.com>
PureWeen added a commit that referenced this pull request Dec 29, 2025
## CollectionView
- Fixed the NRE in CarouselViewController on iOS 15.5 & 16.4 by
@Ahamed-Ali in #30838
  <details>
  <summary>🔧 Fixes</summary>

- [NRE in CarouselViewController on iOS 15.5 &
16.4](#28557)
  </details>

- [iOS, macOS] Fixed CollectionView group header size changes with
ItemSizingStrategy by @NanthiniMahalingam in
#33161
  <details>
  <summary>🔧 Fixes</summary>

- [[NET 10] I6_Grouping - Grouping_with_variable_sized_items changing
the 'ItemSizingStrategy' also changes the header
size.](#33130)
  </details>

## Flyout
- Add unit tests for TabBar and FlyoutItem navigation
ApplyQueryAttributes (#25663) by @StephaneDelcroix in
#33006

## Flyoutpage
- Fixed the FlyoutPage.Flyout Disappearing When Maximizing the Window on
Mac Platform by @NanthiniMahalingam in
#26701
  <details>
  <summary>🔧 Fixes</summary>

- [FlyoutPage.Flyout - navigation corrupted when running om mac , on
window ok](#22719)
  </details>

## Mediapicker
- [Windows] Fix for PickPhotosAsync throws exception if image is
modified by @HarishwaranVijayakumar in
#32952
  <details>
  <summary>🔧 Fixes</summary>

- [PickPhotosAsync throws exception if image is
modified.](#32408)
  </details>

## Navigation
- Fix for TabBar Navigation does not invoke its
IQueryAttributable.ApplyQueryAttributes(query) by @SuthiYuvaraj in
#25663
  <details>
  <summary>🔧 Fixes</summary>

- [Tabs defined in AppShell.xaml does not invoke its view model's
IQueryAttributable.ApplyQueryAttributes(query)
implementaion](#13537)
- [`ShellContent` routes do not call
`ApplyQueryAttributes`](#28453)
  </details>

## ScrollView
- Fix ScrollToPosition.Center behavior in ScrollView on iOS and
MacCatalyst by @devanathan-vaithiyanathan in
#26825
  <details>
  <summary>🔧 Fixes</summary>

- [ScrollToPosition.Center Centers the First Item too in iOS and
Catalyst](#26760)
- [On iOS - ScrollView.ScrollToAsync Element,
ScrollToPosition.MakeVisible shifts view to the right, instead of just
scrolling vertically](#28965)
  </details>

## Searchbar
- [iOS, Mac, Windows] Fixed CharacterSpacing for SearchBar text and
placeholder text by @Dhivya-SF4094 in
#30407
  <details>
  <summary>🔧 Fixes</summary>

- [[iOS, Mac, Windows] SearchBar CharacterSpacing property is not
working as expected](#30366)
  </details>

## Shell
- Update logic for large title display mode on iOS - shell by @kubaflo
in #33039

## TitleView
- [iOS] Fixed memory leak with PopToRootAsync when using TitleView by
@Vignesh-SF3580 in #28547
  <details>
  <summary>🔧 Fixes</summary>

- [NavigationPage.TitleView causes memory leak with
PopToRootAsync](#28201)
  </details>

## Xaml
- [C] Fix binding to interface-inherited properties like
IReadOnlyList<T>.Count by @StephaneDelcroix in
#32912
  <details>
  <summary>🔧 Fixes</summary>

- [Compiled Binding to Array.Count provides no
result](#13872)
  </details>

- Fix #31939: CommandParameter TemplateBinding lost during reparenting
by @StephaneDelcroix in #32961
  <details>
  <summary>🔧 Fixes</summary>

- [CommandParameter TemplateBinding Lost During ControlTemplate
Reparenting](#31939)
  </details>


<details>
<summary>🧪 Testing (4)</summary>

- [Testing] Fixed Test case failure in PR 33185 - [12/22/2025] Candidate
by @TamilarasanSF4853 in #33257
- [Testing] Re-saved ShouldFlyoutBeVisibleAfterMaximizingWindow test
case images in PR 33185 - [12/22/2025] Candidate by @TamilarasanSF4853
in #33271
- [Testing] Fixed Test case failure in PR 33185 - [12/22/2025] Candidate
- 2 by @TamilarasanSF4853 in #33299
- [Testing] Fixed Test case failure in PR 33185 - [12/22/2025] Candidate
- 3 by @TamilarasanSF4853 in #33311

</details>

<details>
<summary>📦 Other (2)</summary>

- [XSG][BindingSourceGen] Add support for RelayCommand to compiled
bindings by @simonrozsival via @Copilot in
#32954
  <details>
  <summary>🔧 Fixes</summary>

  - [Issue #25818](#25818)
  </details>
- Revert "Update logic for large title display mode on iOS - shell
(#33039)" in cff7f35

</details>
**Full Changelog**:
main...inflight/candidate
StephaneDelcroix pushed a commit that referenced this pull request Jan 5, 2026
…lyst (#26825)

### Issue Details
When scrolling a ScrollView using the ScrollToAsync method with the
ScrollPosition.Center value, the item is incorrectly centered.

### Root Cause
The scroll offset values allow items to scroll into a negative position,
causing the item to be incorrectly centered.
 
### Description of Change
We clamp the scroll offset values to ensure the item does not scroll
into a negative position.

### 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 #26760 
Fixes #28965 

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

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

### Output Screenshot
| Before  | After  |
|---------|--------|
| <video
src="https://github.com/user-attachments/assets/be05f838-42bf-452c-bc1a-a34d02de006f"
width="320" height="240" controls></video> | <video
src="https://github.com/user-attachments/assets/02ca23f1-0d31-49c5-9862-767235845761"
width="320" height="240" controls></video> |

---------

Co-authored-by: Shalini-Ashokan <102292178+Shalini-Ashokan@users.noreply.github.com>
@github-actions github-actions bot locked and limited conversation to collaborators Jan 16, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-scrollview ScrollView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/ios platform/macos macOS / Mac Catalyst

Projects

None yet