-
Notifications
You must be signed in to change notification settings - Fork 1.8k
[Android & iOS] - Fixed Entry and Editor from Accepting Input Values While Hidden. #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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; | ||
} | ||
} | ||
} |
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)] | ||
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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we include a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As per your suggestion, I have included the |
||
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 |
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.
Could happen the same issue with the SearchBar?, could you verify?
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.
@jsuarezruiz,
No, the same behavior does not occur with the search bar. When the SearchBar's Visibility is set to Collapsed, it appropriately hides the keyboard as expected. This behavior has been applied consistently to Entry and Editor, ensuring uniform handling across these components.