-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix HideSoftInputOnTapped Not Working Net9 #28534
Fix HideSoftInputOnTapped Not Working Net9 #28534
Conversation
Hey there @SuthiYuvaraj! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes issue #26792 by ensuring that the HideSoftInputOnTapped feature works correctly even when a ContentPage is set as the direct window. Key changes include:
- Adding UI test cases in both TestCases.Shared.Tests and TestCases.HostApp.
- Modifying conditionals in HideSoftInputOnTappedChangedManager and its platform-specific implementations to consider pages whose Parent is a Window.
- Updating Android-specific code to align with the new condition.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue26792.cs | Added test case to verify soft keyboard behavior |
src/Controls/tests/TestCases.HostApp/Issues/Issue26792.cs | Updated UI for Issue26792 to support HideSoftInputOnTapped |
src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.cs | Updated conditional to check for direct window usage |
src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Android.cs | Updated condition for Android platform-specific handling |
src/Controls/src/Core/ContentPage/HideSoftInputOnTappedChanged/HideSoftInputOnTappedChangedManager.Platform.cs | Updated condition in UpdatePage to handle direct window |
/rebase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just blocking as something is triggering my brain... This HasNavigatedTo
property, should it be set to true in this instance?
Almost like if you set Window.Page = somthing, that something is supposed to get auto navigated to?
I feel like this PR fixes a symptom of another problem in this PR: #23420 |
Maybe we can land this PR now to get the issue fixed, and then we can fix it properly and remove this workaround? @PureWeen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving for now as this code is fine based on the current state of the system. However, a better fix is needed which was started in #23420
Issue Description
When the
MainPage
is set as the direct window, enablingHideSoftInputOnTapped
prevents the keyboard from hiding when tapping on the screen.Root Cause
The page receives touch input through
ResignFirstResponderTouchGestureRecognizer
, controlled by theHasNavigatedTo
value. This mechanism applies to bothUpdateFocusForView
andSetHideSoftInputTapped
. For a directContentPage
,HasNavigatedTo
remainsfalse
but updates totrue
inSendNavigatingTo
when used withinNavigationPage
. Hence this works fine for the navigation page.Description of Change
During
UpdatePage
, when adding the page to the collection, the parent is checked. If it is a direct window, the page is added to the collection. Additionally, thepage count
is considered forFeatureEnabled
and theOnTapped
event to handleHideSoftInput
.Issues Fixed
Fixes #26792
Fixes #21681
Tested the behaviour in the following platforms
Output Screenshot
HideSoftBeforeFix.mov
HideSoftAfterFix.mov