-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[Android & iOS] Entry/Editor: Dismiss keyboard when control becomes invisible #27340
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
Merged
PureWeen
merged 5 commits into
dotnet:inflight/current
from
prakashKannanSf3972:fix-27236
Feb 3, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9e45b75
Fixed-EditorAndEntrykeyboardVisiblity-Issue
prakashKannanSf3972 2d20266
Test-Updated
prakashKannanSf3972 3a2a7b3
Added-VerifyScreenShot
prakashKannanSf3972 5e7b3dd
Added-Android-SnapShot
prakashKannanSf3972 666aa34
Added-Comment
prakashKannanSf3972 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
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
Binary file added
BIN
+12.4 KB
...ols/tests/TestCases.Android.Tests/snapshots/android/VerifyEditorsNotVisible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [Issue(IssueTracker.Github, 27236, "android allows type into hidden Entry control", PlatformAffected.Android | PlatformAffected.iOS)] | ||
| public partial class Issue27236 : TestContentPage | ||
| { | ||
| protected override void Init() | ||
| { | ||
| StackLayout mainLayout = new StackLayout | ||
| { | ||
| Padding = new Thickness(10) | ||
| }; | ||
|
|
||
| Entry toggleableEntry = new Entry | ||
| { | ||
| AutomationId = "ToggleableEntry", | ||
| IsVisible = false | ||
| }; | ||
|
|
||
| Editor toggleableEditor = new Editor | ||
| { | ||
| AutomationId = "ToggleableEditor", | ||
| IsVisible = false | ||
| }; | ||
|
|
||
| Button toggleEntryVisibilityButton = new Button | ||
| { | ||
| AutomationId = "ToggleEntryVisibilityButton", | ||
| Text = "Toggle Entry Visibility" | ||
| }; | ||
|
|
||
| Button toggleEditorVisibilityButton = new Button | ||
| { | ||
| AutomationId = "ToggleEditorVisibilityButton", | ||
| Text = "Toggle Editor Visibility" | ||
| }; | ||
|
|
||
| toggleEntryVisibilityButton.Clicked += (sender, e) => ToggleVisibility(toggleableEntry); | ||
| toggleEditorVisibilityButton.Clicked += (sender, e) => ToggleVisibility(toggleableEditor); | ||
|
|
||
| void ToggleVisibility(VisualElement element) | ||
| { | ||
| element.IsVisible = !element.IsVisible; | ||
| } | ||
|
|
||
| mainLayout.Children.Add(toggleableEntry); | ||
| mainLayout.Children.Add(toggleableEditor); | ||
| mainLayout.Children.Add(toggleEntryVisibilityButton); | ||
| mainLayout.Children.Add(toggleEditorVisibilityButton); | ||
|
|
||
| Content = mainLayout; | ||
| } | ||
| } | ||
| } |
45 changes: 45 additions & 0 deletions
45
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue27236.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #if ANDROID || IOS // Desktop platforms do not have a soft keyboard, so the test is restricted to Android and iOS. | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
|
|
||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue27236 : _IssuesUITest | ||
| { | ||
| public Issue27236(TestDevice testDevice) : base(testDevice) | ||
| { | ||
| } | ||
|
|
||
| public override string Issue => "android allows type into hidden Entry control"; | ||
|
|
||
| [Test, Order(1)] | ||
| [Category(UITestCategories.Entry)] | ||
kubaflo marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| public void VerifyEntryKeyboardVisibilityToggle() | ||
| { | ||
| App.WaitForElement("ToggleEntryVisibilityButton"); | ||
| App.Tap("ToggleEntryVisibilityButton"); | ||
| var element = App.WaitForElement("ToggleableEntry"); | ||
| element.SendKeys("Hello, Entry"); | ||
| App.Tap("ToggleEntryVisibilityButton"); | ||
| var keyboardVisible = App.IsKeyboardShown(); | ||
| Assert.That(keyboardVisible, Is.False); | ||
| VerifyScreenshot("VerifyEditorsNotVisible"); | ||
| } | ||
|
|
||
| [Test, Order(2)] | ||
| [Category(UITestCategories.Editor)] | ||
| public void VerifyEditorKeyboardVisibilityToggle() | ||
| { | ||
| App.WaitForElement("ToggleEditorVisibilityButton"); | ||
| App.Tap("ToggleEditorVisibilityButton"); | ||
| var element = App.WaitForElement("ToggleableEditor"); | ||
| element.SendKeys("Hello, Editor"); | ||
| App.Tap("ToggleEditorVisibilityButton"); | ||
| var keyboardVisible = App.IsKeyboardShown(); | ||
| Assert.That(keyboardVisible, Is.False); | ||
| VerifyScreenshot("VerifyEditorsNotVisible"); | ||
| } | ||
| } | ||
| } | ||
| #endif | ||
Binary file added
BIN
+10.3 KB
src/Controls/tests/TestCases.iOS.Tests/snapshots/ios/VerifyEditorsNotVisible.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.