Repository navigation
[Inflight/Candidate] [iOS] Fix for CollectionView layout issue after iOS device rotation - #38815
Merged
Merged
Conversation
…nt changes and preserve dynamic content updates. Backport-of: #38771 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
temporarily deployed
to
copilot-pat-pool
September 23, 2026 16:23 — 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. |
kubaflo
temporarily deployed
to
copilot-pat-pool
September 23, 2026 16:24 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
September 23, 2026 16:25 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
September 23, 2026 16:27 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
September 23, 2026 16:28 — with
GitHub Actions
Inactive
kubaflo
temporarily deployed
to
copilot-pat-pool
September 23, 2026 16:28 — with
GitHub Actions
Inactive
This was referenced Sep 23, 2026
kubaflo
added a commit
that referenced
this pull request
Sep 27, 2026
…iOS device rotation (#38815) <!-- 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! ### Backport Backport of #38771 from `inflight/current` to `inflight/candidate`. The fix, regression test, and all three screenshot baselines are unchanged from the original PR. ### Root cause The issue occurs because of the cell being arranged too early during the preferred layout pass when the collection view constraints change during device rotation. This updates the cached arranged size before LayoutSubviews receives the final native bounds, which can cause the layout to skip the required final arrangement and result in incorrect item positioning or sizing in RTL layouts. ### Solution description The fix involves deferring the arrangement to LayoutSubviews when the layout constraints change, such as during device rotation, so the cell can be arranged using the actual native bounds. At the same time, inline arrangement is retained for dynamic content changes to preserve the behavior introduced by the existing CollectionView2 dynamic content fix. ### Regression PR #37437 ### Validation The original PR reports validation on iOS. Platform tests were not rerun for this backport. Repository formatting completed successfully, and the candidate patch ID matches the original commit exactly, including the binary screenshot baselines. ### Issues Fixed Fixes #38622 ### Output ScreenShot Before/after recordings from the original PR: |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/4c2b5c8f-fd29-40b0-a8f3-5063684dc6fd">| <video src="https://github.com/user-attachments/assets/948ef0eb-f31d-47e7-b7a9-509a54680f16">| Co-authored-by: BagavathiPerumal <bagavathiperumal.a@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
added a commit
that referenced
this pull request
Oct 3, 2026
…iOS device rotation (#38815) <!-- 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! ### Backport Backport of #38771 from `inflight/current` to `inflight/candidate`. The fix, regression test, and all three screenshot baselines are unchanged from the original PR. ### Root cause The issue occurs because of the cell being arranged too early during the preferred layout pass when the collection view constraints change during device rotation. This updates the cached arranged size before LayoutSubviews receives the final native bounds, which can cause the layout to skip the required final arrangement and result in incorrect item positioning or sizing in RTL layouts. ### Solution description The fix involves deferring the arrangement to LayoutSubviews when the layout constraints change, such as during device rotation, so the cell can be arranged using the actual native bounds. At the same time, inline arrangement is retained for dynamic content changes to preserve the behavior introduced by the existing CollectionView2 dynamic content fix. ### Regression PR #37437 ### Validation The original PR reports validation on iOS. Platform tests were not rerun for this backport. Repository formatting completed successfully, and the candidate patch ID matches the original commit exactly, including the binary screenshot baselines. ### Issues Fixed Fixes #38622 ### Output ScreenShot Before/after recordings from the original PR: |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/4c2b5c8f-fd29-40b0-a8f3-5063684dc6fd">| <video src="https://github.com/user-attachments/assets/948ef0eb-f31d-47e7-b7a9-509a54680f16">| Co-authored-by: BagavathiPerumal <bagavathiperumal.a@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
added a commit
that referenced
this pull request
Oct 6, 2026
…iOS device rotation (#38815) <!-- 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! ### Backport Backport of #38771 from `inflight/current` to `inflight/candidate`. The fix, regression test, and all three screenshot baselines are unchanged from the original PR. ### Root cause The issue occurs because of the cell being arranged too early during the preferred layout pass when the collection view constraints change during device rotation. This updates the cached arranged size before LayoutSubviews receives the final native bounds, which can cause the layout to skip the required final arrangement and result in incorrect item positioning or sizing in RTL layouts. ### Solution description The fix involves deferring the arrangement to LayoutSubviews when the layout constraints change, such as during device rotation, so the cell can be arranged using the actual native bounds. At the same time, inline arrangement is retained for dynamic content changes to preserve the behavior introduced by the existing CollectionView2 dynamic content fix. ### Regression PR #37437 ### Validation The original PR reports validation on iOS. Platform tests were not rerun for this backport. Repository formatting completed successfully, and the candidate patch ID matches the original commit exactly, including the binary screenshot baselines. ### Issues Fixed Fixes #38622 ### Output ScreenShot Before/after recordings from the original PR: |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/4c2b5c8f-fd29-40b0-a8f3-5063684dc6fd">| <video src="https://github.com/user-attachments/assets/948ef0eb-f31d-47e7-b7a9-509a54680f16">| Co-authored-by: BagavathiPerumal <bagavathiperumal.a@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
added a commit
that referenced
this pull request
Oct 13, 2026
…iOS device rotation (#38815) <!-- 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! ### Backport Backport of #38771 from `inflight/current` to `inflight/candidate`. The fix, regression test, and all three screenshot baselines are unchanged from the original PR. ### Root cause The issue occurs because of the cell being arranged too early during the preferred layout pass when the collection view constraints change during device rotation. This updates the cached arranged size before LayoutSubviews receives the final native bounds, which can cause the layout to skip the required final arrangement and result in incorrect item positioning or sizing in RTL layouts. ### Solution description The fix involves deferring the arrangement to LayoutSubviews when the layout constraints change, such as during device rotation, so the cell can be arranged using the actual native bounds. At the same time, inline arrangement is retained for dynamic content changes to preserve the behavior introduced by the existing CollectionView2 dynamic content fix. ### Regression PR #37437 ### Validation The original PR reports validation on iOS. Platform tests were not rerun for this backport. Repository formatting completed successfully, and the candidate patch ID matches the original commit exactly, including the binary screenshot baselines. ### Issues Fixed Fixes #38622 ### Output ScreenShot Before/after recordings from the original PR: |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/4c2b5c8f-fd29-40b0-a8f3-5063684dc6fd">| <video src="https://github.com/user-attachments/assets/948ef0eb-f31d-47e7-b7a9-509a54680f16">| Co-authored-by: BagavathiPerumal <bagavathiperumal.a@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
added a commit
that referenced
this pull request
Oct 14, 2026
…iOS device rotation (#38815) <!-- 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! ### Backport Backport of #38771 from `inflight/current` to `inflight/candidate`. The fix, regression test, and all three screenshot baselines are unchanged from the original PR. ### Root cause The issue occurs because of the cell being arranged too early during the preferred layout pass when the collection view constraints change during device rotation. This updates the cached arranged size before LayoutSubviews receives the final native bounds, which can cause the layout to skip the required final arrangement and result in incorrect item positioning or sizing in RTL layouts. ### Solution description The fix involves deferring the arrangement to LayoutSubviews when the layout constraints change, such as during device rotation, so the cell can be arranged using the actual native bounds. At the same time, inline arrangement is retained for dynamic content changes to preserve the behavior introduced by the existing CollectionView2 dynamic content fix. ### Regression PR #37437 ### Validation The original PR reports validation on iOS. Platform tests were not rerun for this backport. Repository formatting completed successfully, and the candidate patch ID matches the original commit exactly, including the binary screenshot baselines. ### Issues Fixed Fixes #38622 ### Output ScreenShot Before/after recordings from the original PR: |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/4c2b5c8f-fd29-40b0-a8f3-5063684dc6fd">| <video src="https://github.com/user-attachments/assets/948ef0eb-f31d-47e7-b7a9-509a54680f16">| Co-authored-by: BagavathiPerumal <bagavathiperumal.a@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 of 4 tasks
kubaflo
pushed a commit
that referenced
this pull request
Oct 16, 2026
…ctionView2 (#39396) <!-- 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. !!!!!!! --> ### Root cause The issue occurs because TemplatedCell2 used the most recent managed arrange size to determine whether UIKit had changed the cell’s native bounds. Preferred-size calculations can update this value before UIKit applies its final bounds, making native size changes difficult to detect. PR #38815 allowed any pending arrange to trigger a final arrangement, resulting in redundant arrange passes when the native bounds had not changed and increasing the count to approximately 354. ### Solution description The fix involves tracking UIKit’s native bounds size separately from the last managed arrange size. LayoutSubviewscompares consecutive native bounds and performs a pending final arrangement only when the native bounds have changed. This preserves the rotation correction and required inline arrangements for dynamically rebuilt content while avoiding redundant final arrangements when the native bounds remain unchanged. The corrected implementation reduced the arrange-pass count to approximately 327–328. **Reason for test level changes:** The CollectionView2 arrange count increased because recycled or rebound cells now require an inline managed arrangement after measurement invalidation. This work is necessary to ensure dynamically rebuilt child content receives valid geometry and does not render blank. In addition, a genuine native bounds change, such as device rotation, requires a final arrangement using the bounds supplied by UIKit. These required arrangements raise the valid count above the previous baseline, which was established before the current dynamic-content and rotation layout lifecycle. The baseline is therefore increased from 276 to 313 based on repeated corrected runs producing 327–328 arrangements after the existing 5% margin is applied. This is the smallest baseline that accepts valid behavior while continuing to reject the redundant 354-pass behavior. ### Regression PR PR #38815 Validated the behavior in the following platforms - [x] iOS - [ ] Mac - [ ] Window - [ ] Android ### Issues Fixed Fixes #39395 ### Output |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/7ae5fb9f-ed59-4c3a-8b88-02e52d20d104">| <video src="https://github.com/user-attachments/assets/ea367492-c6b5-45d3-ace7-3d8848cdcb6c">|
kubaflo
added a commit
that referenced
this pull request
Oct 18, 2026
…iOS device rotation (#38815) <!-- 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! ### Backport Backport of #38771 from `inflight/current` to `inflight/candidate`. The fix, regression test, and all three screenshot baselines are unchanged from the original PR. ### Root cause The issue occurs because of the cell being arranged too early during the preferred layout pass when the collection view constraints change during device rotation. This updates the cached arranged size before LayoutSubviews receives the final native bounds, which can cause the layout to skip the required final arrangement and result in incorrect item positioning or sizing in RTL layouts. ### Solution description The fix involves deferring the arrangement to LayoutSubviews when the layout constraints change, such as during device rotation, so the cell can be arranged using the actual native bounds. At the same time, inline arrangement is retained for dynamic content changes to preserve the behavior introduced by the existing CollectionView2 dynamic content fix. ### Regression PR #37437 ### Validation The original PR reports validation on iOS. Platform tests were not rerun for this backport. Repository formatting completed successfully, and the candidate patch ID matches the original commit exactly, including the binary screenshot baselines. ### Issues Fixed Fixes #38622 ### Output ScreenShot Before/after recordings from the original PR: |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/4c2b5c8f-fd29-40b0-a8f3-5063684dc6fd">| <video src="https://github.com/user-attachments/assets/948ef0eb-f31d-47e7-b7a9-509a54680f16">| Co-authored-by: BagavathiPerumal <bagavathiperumal.a@syncfusion.com> Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
kubaflo
pushed a commit
that referenced
this pull request
Oct 18, 2026
…ctionView2 (#39396) <!-- 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. !!!!!!! --> ### Root cause The issue occurs because TemplatedCell2 used the most recent managed arrange size to determine whether UIKit had changed the cell’s native bounds. Preferred-size calculations can update this value before UIKit applies its final bounds, making native size changes difficult to detect. PR #38815 allowed any pending arrange to trigger a final arrangement, resulting in redundant arrange passes when the native bounds had not changed and increasing the count to approximately 354. ### Solution description The fix involves tracking UIKit’s native bounds size separately from the last managed arrange size. LayoutSubviewscompares consecutive native bounds and performs a pending final arrangement only when the native bounds have changed. This preserves the rotation correction and required inline arrangements for dynamically rebuilt content while avoiding redundant final arrangements when the native bounds remain unchanged. The corrected implementation reduced the arrange-pass count to approximately 327–328. **Reason for test level changes:** The CollectionView2 arrange count increased because recycled or rebound cells now require an inline managed arrangement after measurement invalidation. This work is necessary to ensure dynamically rebuilt child content receives valid geometry and does not render blank. In addition, a genuine native bounds change, such as device rotation, requires a final arrangement using the bounds supplied by UIKit. These required arrangements raise the valid count above the previous baseline, which was established before the current dynamic-content and rotation layout lifecycle. The baseline is therefore increased from 276 to 313 based on repeated corrected runs producing 327–328 arrangements after the existing 5% margin is applied. This is the smallest baseline that accepts valid behavior while continuing to reject the redundant 354-pass behavior. ### Regression PR PR #38815 Validated the behavior in the following platforms - [x] iOS - [ ] Mac - [ ] Window - [ ] Android ### Issues Fixed Fixes #39395 ### Output |Platform|Before|After| |--|--|--| |iOS| <video src="https://github.com/user-attachments/assets/7ae5fb9f-ed59-4c3a-8b88-02e52d20d104">| <video src="https://github.com/user-attachments/assets/ea367492-c6b5-45d3-ace7-3d8848cdcb6c">|
4 tasks done
2 tasks done
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!
Backport
Backport of #38771 from
inflight/currenttoinflight/candidate. The fix, regression test, and all three screenshot baselines are unchanged from the original PR.Root cause
The issue occurs because of the cell being arranged too early during the preferred layout pass when the collection view constraints change during device rotation. This updates the cached arranged size before LayoutSubviews receives the final native bounds, which can cause the layout to skip the required final arrangement and result in incorrect item positioning or sizing in RTL layouts.
Solution description
The fix involves deferring the arrangement to LayoutSubviews when the layout constraints change, such as during device rotation, so the cell can be arranged using the actual native bounds. At the same time, inline arrangement is retained for dynamic content changes to preserve the behavior introduced by the existing CollectionView2 dynamic content fix.
Regression PR
#37437
Validation
The original PR reports validation on iOS. Platform tests were not rerun for this backport. Repository formatting completed successfully, and the candidate patch ID matches the original commit exactly, including the binary screenshot baselines.
Issues Fixed
Fixes #38622
Output ScreenShot
Before/after recordings from the original PR:
38622-BeforeFix.mov
38622-AfterFix.mov