Skip to content

[Mac] Fix blank content in RefreshView with CollectionView during scrolling - #39352

Merged
kubaflo merged 3 commits into
dotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-39295
Oct 13, 2026
Merged

kubaflo merged 3 commits into
dotnet:inflight/currentfrom
devanathan-vaithiyanathan:fix-39295

Conversation

@devanathan-vaithiyanathan

@devanathan-vaithiyanathan devanathan-vaithiyanathan commented Oct 13, 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:

On Mac Catalyst, a CollectionView hosted inside a RefreshView becomes blank when the user scrolls using the mouse wheel or drags the scrollbar.

Root Cause:

The regression was introduced in PR #37307, where ShouldInvalidateLayoutForBoundsChange was changed to return false whenever the CollectionView's bounds size remained unchanged. However, scrolling changes the bounds origin without changing the size. As a result, the native compositional layout was prevented from processing scroll-related bounds changes, causing CollectionView items to disappear.
In PR #32664, the implementation delegated the invalidation decision to base.ShouldInvalidateLayoutForBoundsChange(newBounds) when the bounds size remained unchanged. The change in PR #37307 altered this behavior by always returning false for such cases.

Description of Changes

Updated ShouldInvalidateLayoutForBoundsChange in LayoutFactory2.cs to align with the behavior in PR #32664 and distinguish between unrelated layout passes and actual scrolling:
When both the bounds size and origin remain unchanged, layout invalidation is skipped to preserve the existing scroll-position behavior and prevent unnecessary layout updates.
When the size remains unchanged but the bounds origin changes during scrolling, the invalidation decision is delegated to the native UICollectionViewCompositionalLayout using base.ShouldInvalidateLayoutForBoundsChange(newBounds).
When the bounds size changes during rotation or window resizing, the layout continues to be invalidated explicitly.

Issues Fixed

Fixes #39295

Regarding Test case

The issue reproduces only during manual scrolling, so this test was skipped.

Tested the behavior in the following platforms.

  • Android
  • Windows
  • iOS
  • Mac
Before After
Mac
Before-39295.mov
Mac
After-39295.mov

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

@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title [Mac] Fix blank content in RefreshView with CollectionView during scrolling [WIP][Mac] Fix blank content in RefreshView with CollectionView during scrolling Oct 13, 2026
@dotnet-policy-service dotnet-policy-service Bot added the partner/syncfusion Issues / PR's with Syncfusion collaboration label Oct 13, 2026
@devanathan-vaithiyanathan devanathan-vaithiyanathan added the community ✨ Community Contribution label Oct 13, 2026
@Tamilarasan-Paranthaman Tamilarasan-Paranthaman added platform/macos macOS / Mac Catalyst area-controls-collectionview CollectionView, CarouselView, IndicatorView labels Oct 13, 2026
@devanathan-vaithiyanathan devanathan-vaithiyanathan changed the title [WIP][Mac] Fix blank content in RefreshView with CollectionView during scrolling [Mac] Fix blank content in RefreshView with CollectionView during scrolling Oct 13, 2026
@sheiksyedm
sheiksyedm marked this pull request as ready for review October 13, 2026 07:50
@sheiksyedm
sheiksyedm requested a balanced review from Copilot October 13, 2026 07:51

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

Automated coverage is needed for both content visibility and preserved scroll-offset behavior.

1 open finding
What changed in this PR

Fixes Mac Catalyst CollectionView content disappearing during scrolling by restoring native compositional-layout invalidation for bounds-origin changes.

Changes:

  • Skips invalidation when bounds are unchanged.
  • Delegates scrolling changes to UIKit while retaining resize invalidation.
  • Lacks automated regression coverage.
File Description
src/​Controls/​src/​Core/​Handlers/​Items2/​iOS/​LayoutFactory2.cs Distinguishes scrolling from unchanged layout passes.

🧠 Review effort: Balanced

Comment on lines +612 to +614
return newBounds.X == currentBounds.X && newBounds.Y == currentBounds.Y
? false
: base.ShouldInvalidateLayoutForBoundsChange(newBounds);
@kubaflo
kubaflo merged commit d3c4280 into dotnet:inflight/current Oct 13, 2026
43 checks passed
@github-actions github-actions Bot added this to the .NET 10 SR12 milestone Oct 13, 2026
kubaflo pushed a commit that referenced this pull request Oct 13, 2026
…olling (#39352)

<!-- 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 Details:
On Mac Catalyst, a CollectionView hosted inside a RefreshView becomes
blank when the user scrolls using the mouse wheel or drags the
scrollbar.
 
### Root Cause:
The regression was introduced in PR #37307, where
ShouldInvalidateLayoutForBoundsChange was changed to return false
whenever the CollectionView's bounds size remained unchanged. However,
scrolling changes the bounds origin without changing the size. As a
result, the native compositional layout was prevented from processing
scroll-related bounds changes, causing CollectionView items to
disappear.
In PR #32664, the implementation delegated the invalidation decision to
base.ShouldInvalidateLayoutForBoundsChange(newBounds) when the bounds
size remained unchanged. The change in PR #37307 altered this behavior
by always returning false for such cases.

### Description of Changes
Updated ShouldInvalidateLayoutForBoundsChange in LayoutFactory2.cs to
align with the behavior in PR #32664 and distinguish between unrelated
layout passes and actual scrolling:
When both the bounds size and origin remain unchanged, layout
invalidation is skipped to preserve the existing scroll-position
behavior and prevent unnecessary layout updates.
When the size remains unchanged but the bounds origin changes during
scrolling, the invalidation decision is delegated to the native
UICollectionViewCompositionalLayout using
base.ShouldInvalidateLayoutForBoundsChange(newBounds).
When the bounds size changes during rotation or window resizing, the
layout continues to be invalidated explicitly.

### 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 #39295 

### Regarding Test case
The issue reproduces only during manual scrolling, so this test was
skipped.

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

 **Tested the behavior in the following platforms.**
- [ ] Android
- [ ] Windows
- [ ] iOS
- [x] Mac


| Before  | After  |
|---------|--------|
| **Mac**<br> <video
src="https://github.com/user-attachments/assets/2f7f8325-5790-44a3-abb3-445b4d291817"
width="600" height="300"> | **Mac**<br> <video
src="https://github.com/user-attachments/assets/34f09a13-3503-4828-9a7f-261a9c84127c"
width="600" height="300"> |
kubaflo added a commit that referenced this pull request Oct 13, 2026
…ectionView during scrolling (#39357)

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

Backports #39352 (merged commit
`d3c4280620f4127b17a520af72c03a28826a3c80`) to `inflight/candidate`, as
requested. This is the unchanged, single-file source patch, applied
without conflicts.

The regressing PR #37307 is already present in candidate as commit
`0c07863584a1e05405104f8cc43c78bba1176007`. Its stable patch ID matches
the original merged commit `8c23a46bba2b214dffcf8b7e2188cf35d92267e8`,
and candidate's layout still unconditionally skipped invalidation for
same-size bounds changes.

The fix preserves the scroll-position guard when bounds size and origin
are unchanged, delegates scrolling-related origin changes to the native
compositional layout, and retains explicit invalidation when bounds size
changes.

#### Validation

| Command | Result |
| --- | --- |
| `dotnet format whitespace --folder --include
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs --verbosity
quiet` | Passed. |
| `git diff --cached --check` | Passed; the backport's stable patch ID
matches #39352. |
| `./build.sh -restore -build -configuration Debug -projects
"$PWD/Microsoft.Maui.BuildTasks.slnf" /p:BuildTaskOnlyBuild=true
/p:MauiPlatforms= -warnAsError false -verbosity quiet` | Passed with the
repository-pinned .NET SDK; 0 warnings, 0 errors. |
| `.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -c
Debug -f net10.0-maccatalyst -p:MauiPlatforms=net10.0-maccatalyst -v
quiet` | Passed; 0 warnings, 0 errors. Confirmed the changed file is
included in the native target. |
| `.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -c
Debug -f net10.0-ios -p:MauiPlatforms=net10.0-ios -v quiet` | Passed; 0
warnings, 0 errors. |

Manual/UI validation was not run. The original Mac Catalyst reproduction
is ManualMaui's C2/C5 RefreshView scenarios. No XCTest or foreground UI
automation was used.

### 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 #39295

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

---------
kubaflo pushed a commit that referenced this pull request Oct 14, 2026
…olling (#39352)

<!-- 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 Details:
On Mac Catalyst, a CollectionView hosted inside a RefreshView becomes
blank when the user scrolls using the mouse wheel or drags the
scrollbar.
 
### Root Cause:
The regression was introduced in PR #37307, where
ShouldInvalidateLayoutForBoundsChange was changed to return false
whenever the CollectionView's bounds size remained unchanged. However,
scrolling changes the bounds origin without changing the size. As a
result, the native compositional layout was prevented from processing
scroll-related bounds changes, causing CollectionView items to
disappear.
In PR #32664, the implementation delegated the invalidation decision to
base.ShouldInvalidateLayoutForBoundsChange(newBounds) when the bounds
size remained unchanged. The change in PR #37307 altered this behavior
by always returning false for such cases.

### Description of Changes
Updated ShouldInvalidateLayoutForBoundsChange in LayoutFactory2.cs to
align with the behavior in PR #32664 and distinguish between unrelated
layout passes and actual scrolling:
When both the bounds size and origin remain unchanged, layout
invalidation is skipped to preserve the existing scroll-position
behavior and prevent unnecessary layout updates.
When the size remains unchanged but the bounds origin changes during
scrolling, the invalidation decision is delegated to the native
UICollectionViewCompositionalLayout using
base.ShouldInvalidateLayoutForBoundsChange(newBounds).
When the bounds size changes during rotation or window resizing, the
layout continues to be invalidated explicitly.

### 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 #39295 

### Regarding Test case
The issue reproduces only during manual scrolling, so this test was
skipped.

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

 **Tested the behavior in the following platforms.**
- [ ] Android
- [ ] Windows
- [ ] iOS
- [x] Mac


| Before  | After  |
|---------|--------|
| **Mac**<br> <video
src="https://github.com/user-attachments/assets/2f7f8325-5790-44a3-abb3-445b4d291817"
width="600" height="300"> | **Mac**<br> <video
src="https://github.com/user-attachments/assets/34f09a13-3503-4828-9a7f-261a9c84127c"
width="600" height="300"> |
kubaflo added a commit that referenced this pull request Oct 14, 2026
…ectionView during scrolling (#39357)

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

Backports #39352 (merged commit
`d3c4280620f4127b17a520af72c03a28826a3c80`) to `inflight/candidate`, as
requested. This is the unchanged, single-file source patch, applied
without conflicts.

The regressing PR #37307 is already present in candidate as commit
`0c07863584a1e05405104f8cc43c78bba1176007`. Its stable patch ID matches
the original merged commit `8c23a46bba2b214dffcf8b7e2188cf35d92267e8`,
and candidate's layout still unconditionally skipped invalidation for
same-size bounds changes.

The fix preserves the scroll-position guard when bounds size and origin
are unchanged, delegates scrolling-related origin changes to the native
compositional layout, and retains explicit invalidation when bounds size
changes.

#### Validation

| Command | Result |
| --- | --- |
| `dotnet format whitespace --folder --include
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs --verbosity
quiet` | Passed. |
| `git diff --cached --check` | Passed; the backport's stable patch ID
matches #39352. |
| `./build.sh -restore -build -configuration Debug -projects
"$PWD/Microsoft.Maui.BuildTasks.slnf" /p:BuildTaskOnlyBuild=true
/p:MauiPlatforms= -warnAsError false -verbosity quiet` | Passed with the
repository-pinned .NET SDK; 0 warnings, 0 errors. |
| `.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -c
Debug -f net10.0-maccatalyst -p:MauiPlatforms=net10.0-maccatalyst -v
quiet` | Passed; 0 warnings, 0 errors. Confirmed the changed file is
included in the native target. |
| `.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -c
Debug -f net10.0-ios -p:MauiPlatforms=net10.0-ios -v quiet` | Passed; 0
warnings, 0 errors. |

Manual/UI validation was not run. The original Mac Catalyst reproduction
is ManualMaui's C2/C5 RefreshView scenarios. No XCTest or foreground UI
automation was used.

### 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 #39295

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

---------
kubaflo pushed a commit that referenced this pull request Oct 18, 2026
…olling (#39352)

<!-- 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 Details:
On Mac Catalyst, a CollectionView hosted inside a RefreshView becomes
blank when the user scrolls using the mouse wheel or drags the
scrollbar.
 
### Root Cause:
The regression was introduced in PR #37307, where
ShouldInvalidateLayoutForBoundsChange was changed to return false
whenever the CollectionView's bounds size remained unchanged. However,
scrolling changes the bounds origin without changing the size. As a
result, the native compositional layout was prevented from processing
scroll-related bounds changes, causing CollectionView items to
disappear.
In PR #32664, the implementation delegated the invalidation decision to
base.ShouldInvalidateLayoutForBoundsChange(newBounds) when the bounds
size remained unchanged. The change in PR #37307 altered this behavior
by always returning false for such cases.

### Description of Changes
Updated ShouldInvalidateLayoutForBoundsChange in LayoutFactory2.cs to
align with the behavior in PR #32664 and distinguish between unrelated
layout passes and actual scrolling:
When both the bounds size and origin remain unchanged, layout
invalidation is skipped to preserve the existing scroll-position
behavior and prevent unnecessary layout updates.
When the size remains unchanged but the bounds origin changes during
scrolling, the invalidation decision is delegated to the native
UICollectionViewCompositionalLayout using
base.ShouldInvalidateLayoutForBoundsChange(newBounds).
When the bounds size changes during rotation or window resizing, the
layout continues to be invalidated explicitly.

### 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 #39295 

### Regarding Test case
The issue reproduces only during manual scrolling, so this test was
skipped.

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

 **Tested the behavior in the following platforms.**
- [ ] Android
- [ ] Windows
- [ ] iOS
- [x] Mac


| Before  | After  |
|---------|--------|
| **Mac**<br> <video
src="https://github.com/user-attachments/assets/2f7f8325-5790-44a3-abb3-445b4d291817"
width="600" height="300"> | **Mac**<br> <video
src="https://github.com/user-attachments/assets/34f09a13-3503-4828-9a7f-261a9c84127c"
width="600" height="300"> |
kubaflo added a commit that referenced this pull request Oct 18, 2026
…ectionView during scrolling (#39357)

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

Backports #39352 (merged commit
`d3c4280620f4127b17a520af72c03a28826a3c80`) to `inflight/candidate`, as
requested. This is the unchanged, single-file source patch, applied
without conflicts.

The regressing PR #37307 is already present in candidate as commit
`0c07863584a1e05405104f8cc43c78bba1176007`. Its stable patch ID matches
the original merged commit `8c23a46bba2b214dffcf8b7e2188cf35d92267e8`,
and candidate's layout still unconditionally skipped invalidation for
same-size bounds changes.

The fix preserves the scroll-position guard when bounds size and origin
are unchanged, delegates scrolling-related origin changes to the native
compositional layout, and retains explicit invalidation when bounds size
changes.

#### Validation

| Command | Result |
| --- | --- |
| `dotnet format whitespace --folder --include
src/Controls/src/Core/Handlers/Items2/iOS/LayoutFactory2.cs --verbosity
quiet` | Passed. |
| `git diff --cached --check` | Passed; the backport's stable patch ID
matches #39352. |
| `./build.sh -restore -build -configuration Debug -projects
"$PWD/Microsoft.Maui.BuildTasks.slnf" /p:BuildTaskOnlyBuild=true
/p:MauiPlatforms= -warnAsError false -verbosity quiet` | Passed with the
repository-pinned .NET SDK; 0 warnings, 0 errors. |
| `.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -c
Debug -f net10.0-maccatalyst -p:MauiPlatforms=net10.0-maccatalyst -v
quiet` | Passed; 0 warnings, 0 errors. Confirmed the changed file is
included in the native target. |
| `.dotnet/dotnet build src/Controls/src/Core/Controls.Core.csproj -c
Debug -f net10.0-ios -p:MauiPlatforms=net10.0-ios -v quiet` | Passed; 0
warnings, 0 errors. |

Manual/UI validation was not run. The original Mac Catalyst reproduction
is ManualMaui's C2/C5 RefreshView scenarios. No XCTest or foreground UI
automation was used.

### 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 #39295

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

---------
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 13, 2026

This branch was previously deployed

1 inactive deployment
copilot-pat-pool — f8b5b245 Deployed Oct 13, 2026 by devanathan-vaithiyanathan via conclusion #2329
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-controls-collectionview CollectionView, CarouselView, IndicatorView community ✨ Community Contribution partner/syncfusion Issues / PR's with Syncfusion collaboration platform/macos macOS / Mac Catalyst

Projects

None yet

Development

Successfully merging this pull request may close these issues.

C2 & C5: Content turns blank when dragging a slider or scrolling the mouse wheel on the Mac Catalyst platform.

4 participants