Repository navigation
[Mac] Fix blank content in RefreshView with CollectionView during scrolling - #39352
Merged
kubaflo merged 3 commits intoOct 13, 2026
Merged
Conversation
devanathan-vaithiyanathan
temporarily deployed
to
copilot-pat-pool
October 13, 2026 07:25 — with
GitHub Actions
Inactive
devanathan-vaithiyanathan
temporarily deployed
to
copilot-pat-pool
October 13, 2026 07:25 — with
GitHub Actions
Inactive
|
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
temporarily deployed
to
copilot-pat-pool
October 13, 2026 07:26 — with
GitHub Actions
Inactive
devanathan-vaithiyanathan
temporarily deployed
to
copilot-pat-pool
October 13, 2026 07:29 — with
GitHub Actions
Inactive
devanathan-vaithiyanathan
temporarily deployed
to
copilot-pat-pool
October 13, 2026 07:31 — with
GitHub Actions
Inactive
devanathan-vaithiyanathan
temporarily deployed
to
copilot-pat-pool
October 13, 2026 07:31 — with
GitHub Actions
Inactive
sheiksyedm
marked this pull request as ready for review
October 13, 2026 07:50
Contributor
There was a problem hiding this comment.
🟡 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); |
This was referenced 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. --> ---------
4 tasks
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. --> ---------
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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.
Before-39295.mov
After-39295.mov