[release/10.0.1xx-sr7] [iOS] Fix Shell - opened keyboard on modal page shifts parent page/frame behind modal after update to 10.0.60 - #35691
Merged
PureWeen merged 2 commits intoJun 2, 2026
Conversation
…ame behind modal after update to 10.0.60 (#35559) <!-- 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: When the keyboard opens in the modal, the parent page/frame behind the modal shifts in the shell. ### Root Cause: PR #33958 added an OnKeyboardWillHide handler to ShellPageRendererTracker to fix an iOS timing bug where a Shell page view would land at Y=0 (underneath the navigation bar) when the keyboard dismissed during a page navigation. The handler worked by detecting this misposition and correcting the view frame. However, the observer was registered using UIKeyboard.Notifications.ObserveWillHide — a global notification that fires for every live ShellPageRendererTracker instance whenever any keyboard is dismissed, regardless of which page triggered it. This becomes a problem when a transparent modal page is presented via Shell.GoToAsync. In iOS, modal presentation does not push the modal onto the navigation controller's view controller stack — it sits above the stack as a separate presented view controller. This means navController.TopViewController still points to the underlying Shell page, so the existing guard ViewController == navController.TopViewController evaluated to true for the page behind the modal. With _pendingKeyboardNavigation still armed from the page's initial load, dismissing the keyboard inside the modal triggered the frame correction on the underlying page, causing the visible vertical offset reported in the issue. Two secondary bugs compounded this: the SearchHandler early-return and the hidden-nav-bar early-return both exited the method without clearing _pendingKeyboardNavigation, leaving the flag permanently armed after those paths — meaning any future keyboard dismissal could incorrectly fire the frame correction long after the intended one-shot timing window had passed. ### Description of Change: The fix adds a single guard at the top of OnKeyboardWillHide: if navController.PresentedViewController is not null, the method returns immediately without clearing _pendingKeyboardNavigation. Using PresentedViewController is the idiomatic UIKit way to detect that a modal is covering the navigation controller, and returning without consuming the flag ensures the original page-load correction still works if a keyboard event fires on this page after the modal is dismissed. The two secondary leaks are also patched both the hidden-nav-bar path and the SearchHandler path now explicitly set _pendingKeyboardNavigation = false before returning, so the flag is always consumed once the correction window is definitively over. **Tested the behavior in the following platforms:** - [x] Android - [ ] Windows - [x] iOS - [ ] Mac ### Reference: N/A ### Issues Fixed: Fixes #35401 ### Screenshots | Before | After | |---------|--------| | <Video src="https://github.com/user-attachments/assets/a9da8996-3caf-4932-a5ca-a22dc72a302c" Width="300" Height="600"/> | <Video src="https://github.com/user-attachments/assets/503ced7d-24de-4410-aaf2-63c684211564" Width="300" Height="600"/> | (cherry picked from commit 18b6947)
Contributor
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 35691Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 35691" |
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
This was referenced Jun 2, 2026
Open
This was referenced Jun 2, 2026
Contributor
|
/azp run |
|
Azure Pipelines successfully started running 3 pipeline(s). |
3 tasks
PureWeen
approved these changes
Jun 2, 2026
This was referenced Jun 10, 2026
Closed
Closed
Merged
This was referenced Jun 29, 2026
Closed
This was referenced Jul 6, 2026
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 of #35559 to
release/10.0.1xx-sr7./cc @PureWeen