-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fixed picker allows user input if the keyboard is visible #26382
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
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
a5b55a2
Fixed The picker allows you to write text if the keyboard is visible
NirmalKumarYuvaraj a15b640
Modified test case and image
NirmalKumarYuvaraj 3dc319a
Fixed test case failure with diff approach
NirmalKumarYuvaraj dd7ddd8
updated code changes
NirmalKumarYuvaraj 43e6703
modified code changes
NirmalKumarYuvaraj a41311f
Fixed The picker allows you to write text if the keyboard is visible
NirmalKumarYuvaraj 517981c
Modified test case and image
NirmalKumarYuvaraj 89fdf7d
Fixed test case failure with diff approach
NirmalKumarYuvaraj 5328e23
updated code changes
NirmalKumarYuvaraj 3ade9eb
modified code changes
NirmalKumarYuvaraj 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
There are no files selected for viewing
Binary file added
BIN
+7.98 KB
...ndroid.Tests/snapshots/android/PickerShouldNotAllowUserInputThroughKeyboard.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,29 @@ | ||
| namespace Maui.Controls.Sample.Issues | ||
| { | ||
| [Issue(IssueTracker.Github, 24930, "The picker allows you to write text if the keyboard is visible", PlatformAffected.Android)] | ||
| public partial class Issue24930 : ContentPage | ||
| { | ||
| const string FirstPickerItem = "Baboon"; | ||
| const string PickerId = "picker"; | ||
| public Issue24930() | ||
| { | ||
| Picker picker = new Picker | ||
| { | ||
| AutomationId = PickerId, | ||
| Title = "Select a monkey" | ||
| }; | ||
|
|
||
|
|
||
| picker.ItemsSource = new List<string> | ||
| { | ||
| FirstPickerItem, | ||
| "Capuchin Monkey" | ||
| }; | ||
|
|
||
| Content = new StackLayout() | ||
| { | ||
| Children = { picker } | ||
| }; | ||
| } | ||
| } | ||
| } |
40 changes: 40 additions & 0 deletions
40
src/Controls/tests/TestCases.Shared.Tests/Tests/Issues/Issue24930.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,40 @@ | ||
| #if ANDROID // This test is only for Android, Since the edit text is base view for Picker in Android | ||
| using NUnit.Framework; | ||
| using UITest.Appium; | ||
| using UITest.Core; | ||
| namespace Microsoft.Maui.TestCases.Tests.Issues | ||
| { | ||
| public class Issue24930 : _IssuesUITest | ||
| { | ||
| const string FirstPickerItem = "Baboon"; | ||
| const string PickerId = "picker"; | ||
|
|
||
| public Issue24930(TestDevice device) : base(device) { } | ||
|
|
||
| public override string Issue => "The picker allows you to write text if the keyboard is visible"; | ||
|
|
||
| // Key codes for "abcd" | ||
| int[] keyCodes = new int[] | ||
| { | ||
| 29,30,31,32 | ||
| }; | ||
|
|
||
| [Test] | ||
| [Category(UITestCategories.Picker)] | ||
| public void PickerShouldNotAllowUserInputThroughKeyboard() | ||
| { | ||
| App.WaitForElement(PickerId); | ||
| App.Tap(PickerId); | ||
| App.WaitForElement(FirstPickerItem); | ||
| App.Back(); | ||
| foreach (var keyCode in keyCodes) | ||
| { | ||
| App.SendKeys(keyCode); | ||
| } | ||
|
|
||
| VerifyScreenshot(); | ||
| } | ||
|
|
||
| } | ||
| } | ||
| #endif |
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
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.
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.
I don't think we'll want to handle every single keypress event.
This will probably break scenarios where a user has a hardware keyboard connected to the device and is trying to use tab to navigate components
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.
@PureWeen , Pressing the Tab key focuses on the EditText, causing the picker dialog to open. Navigation does not occur between the components. According to the implementation, a change in focus triggers the dialog to appear on the view. I have shared a video for reference. please let me know if you have any concerns.
Screen.Recording.2025-03-11.at.5.33.22.PM.mov