Fix CollectionView not scrolling to top on iOS status bar tap#34687
Open
jfversluis wants to merge 1 commit intomainfrom
Open
Fix CollectionView not scrolling to top on iOS status bar tap#34687jfversluis wants to merge 1 commit intomainfrom
jfversluis wants to merge 1 commit intomainfrom
Conversation
On iOS, tapping the status bar should scroll the topmost UIScrollView to the top. This was not working for CollectionView, particularly inside Shell. Root cause: iOS disables scroll-to-top when multiple UIScrollViews in the view hierarchy have scrollsToTop=true. The Shell flyout's internal AccessibilityNeutralTableView (UITableView) defaults scrollsToTop to true, conflicting with the CollectionView's UICollectionView. Fix: - Set CollectionView.ScrollsToTop = true in ItemsViewController2.ViewDidLoad() to explicitly opt in to scroll-to-top behavior - Set ScrollsToTop = false on Shell's AccessibilityNeutralTableView to prevent the multi-scroll-view conflict Fixes #19866 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 34687Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 34687" |
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
This was referenced Mar 27, 2026
Collaborator
🚦 Gate — Test Verification📊 Expand Full Gate —
|
Collaborator
🤖 AI Summary📊 Expand Full Review —
|
| # | Source | Approach | Test Result | Files Changed | Notes |
|---|---|---|---|---|---|
| PR | PR #34687 | Set CollectionView.ScrollsToTop = true in ItemsViewController2.ViewDidLoad() + Set ScrollsToTop = false in AccessibilityNeutralTableView() constructor |
❌ Gate FAILED (no tests) | ItemsViewController2.cs, ShellTableViewController.cs |
3 lines total; class-level fix; follows codebase pattern |
kubaflo
requested changes
Mar 28, 2026
Contributor
kubaflo
left a comment
There was a problem hiding this comment.
FIx looks good, but maybe some tests are possible ;)
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
Fixes #19866
On iOS, tapping the status bar should scroll the topmost
UIScrollViewto the top. This was not working forCollectionView, particularly when hosted inside aShell.Root Cause
iOS disables its scroll-to-top behavior when multiple
UIScrollViewinstances in the view hierarchy havescrollsToTop = true. The Shell flyout's internalAccessibilityNeutralTableView(aUITableViewsubclass) defaultsscrollsToToptotrue, conflicting with theCollectionView'sUICollectionView.Fix
Two changes:
ItemsViewController2.ViewDidLoad()— Explicitly setCollectionView.ScrollsToTop = trueto opt in to scroll-to-top behaviorShellTableViewController.AccessibilityNeutralTableView— SetScrollsToTop = falseon Shell's flyout table view to prevent the multi-scroll-view conflictThis follows the existing codebase pattern where
ScrollsToTopis explicitly managed (e.g.,ShellSectionRootHeaderandContextActionCellboth set it tofalse).Validation
Verified with a Sandbox app using a grouped
CollectionViewinside aShellwithTabBar:scrollsToTop=True→ status bar tap does nothingMauiCollectionViewhasscrollsToTop=True→ status bar tap scrolls to top correctly