dotnet / maui

.NET MAUI is the .NET Multi-platform App UI, a framework for building native device applications spanning mobile, tablet, and desktop.
https://dot.net/maui
MIT License
22.01k stars 1.72k forks source link

Android Picker Issue (User can input text) #8265

Open DeepWorksStudios opened 2 years ago

DeepWorksStudios commented 2 years ago

Description

If you have a control that opens your keyboard, the user can enter text in the selection title of the picker element. There is no option to prevent this

Reproduction Repo: https://github.com/DeepWorksStudios/ReproductionProjectBug8265_PickerText

Steps to Reproduce

  1. Create Maui project

  2. Target Android

  3. Add an entry or other control that uses the keyboard.

  4. add picker with some dummy data

  5. start the emulator or the device

  6. Tap on the control that uses the keyboard.

  7. Tap on the picker and select nothing.

  8. Type something on the keyboard and select Cancel or tap outside the picker.

  9. Check the title text of the picker list.

Version with bug

6.0.400 (current)

Last version that worked well

Unknown/Other

Affected platforms

Android

Affected platform versions

All Android Version

Did you find any workaround?

No

Relevant log output

None
kristinx0211 commented 2 years ago

verified repro on android with above project.

jsuarezruiz commented 2 years ago

How do you keep the keyboard open? issue-8265

DeepWorksStudios commented 2 years ago

Tested On Android 10 API 29 Samsung S9+ Seems like you really need to have the keyboard open and get the picker in focus and than you can type aswell in the case you selected somthing.

Look at the recording

https://user-images.githubusercontent.com/59297046/175557531-836b5926-f70f-462c-beaf-86ce13360619.mp4

ghost commented 2 years ago

We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.

jroessel commented 1 year ago

This can also be tested with a device that has a keyboard attached, or in the emulator. Which is perhaps easier to test than trying desperately to keep the on-screen keyboard open.

DeepWorksStudios commented 1 year ago

Any updates ?

cat0363 commented 1 year ago

Hi, @DeepWorksStudios I had the same problem as you. If you just want to disable the key input of Picker, you can do it by the following method. https://github.com/cat0363/Maui-Workaround8265

It is possible by reimplementing PickerHandler and setting KeyListener=null in CreatePlatformView. However, this is a workaround, not a solution.

DeepWorksStudios commented 1 year ago

@cat0363 thanks for the tipp. I will try that workaround out but its unfortunate that the bug still remains unfixed by the developer team :/

Mzazvor commented 1 year ago

Im also experiencing this issue on android device with physical keyboard. I will look into the workaround. Thanx

jinxinjuan commented 1 year ago

Verified this issue with Visual Studio Enterprise 17.6.0 Preview 7.0. Repro on Android platform with sample project. ReproductionProjectBug8265_PickerText

DeepWorksStudios commented 1 year ago

I investigated this problem again and found that the behaviour of my real devices is now as expected by default and the problem does not occur, but I found out why because they behave differently. The page pushes up as soon as you open the virtual keyboard, and only in the emulator or with a physical keyboard connected (or possibly a phone with a physical keyboard) can you switch to the picker by pressing the tab key, for example. in the past, the page did not push up, as the above entry confirms.

adding thouse commands to the app.xaml forces the app to act as wanted without pushing up the page (because its not suitable for exsample a chat app) and that way you still can cause the issuee as descirbed in the initial post

 xmlns:android="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.AndroidSpecific;assembly=Microsoft.Maui.Controls"
 android:Application.WindowSoftInputModeAdjust="Resize"

i will update the repo accordingly

DeepWorksStudios commented 1 year ago

@jsuarezruiz Could you take care of this problem as soon as you have time? We would all appreciate it very much.

I have provided additional information on this problem in my last post

DeepWorksStudios commented 1 year ago

Any updates?

DeepWorksStudios commented 1 year ago

Unfortunately no one is responding even though I have provided new information on this issue. It's like it doesn't make a difference, I'm really starting to doubt if it's worth it for me to keep reporting this problem as more time is spent on these reports and diagnosing and if it's not fixed in a respectable amount of time, it's not worth my time. Let someone else do it

DeepWorksStudios commented 8 months ago

Does anyone work on this issue?

DeepWorksStudios commented 8 months ago

Its still present with the latest version of dotnet 8 and the lastest version of .net maui 8.0.6

DeepWorksStudios commented 8 months ago

I updated the repo accordingly

sillerjp commented 7 months ago

If it helps, I managed to workaround with the following code, using a renderer to make sure it applies to all pickers within the app. It basically hides the keyboard on focus.

`#if ANDROID Microsoft.Maui.Handlers.PickerHandler.Mapper.AppendToMapping("PickerKeyboard", (handler, view) => { handler.PlatformView.FocusChange += (s, e) => { if (e.HasFocus) { var imm = (Android.Views.InputMethods.InputMethodManager)handler.PlatformView.Context.GetSystemService(Android.App.Activity.InputMethodService); imm.HideSoftInputFromWindow(handler.PlatformView.WindowToken, 0); } }; });

endif`

DeepWorksStudios commented 7 months ago

If it helps, I managed to workaround with the following code, using a renderer to make sure it applies to all pickers within the app. It basically hides the keyboard on focus.

`#if ANDROID

        Microsoft.Maui.Handlers.PickerHandler.Mapper.AppendToMapping("PickerKeyboard", (handler, view) =>

        {

            handler.PlatformView.FocusChange += (s, e) =>

            {

                if (e.HasFocus)

                {

                    var imm = (Android.Views.InputMethods.InputMethodManager)handler.PlatformView.Context.GetSystemService(Android.App.Activity.InputMethodService);

                    imm.HideSoftInputFromWindow(handler.PlatformView.WindowToken, 0);

                }

            };

        });

endif`

Sadly that won't solve the issue since if a keyboard is connected or the emulator is used than it does not need the display keyboard shown you can just type and it will modify the picker text unwanted.. I hope they soon solve this issue it's been a time..

DeepWorksStudios commented 7 months ago

Verified this issue with Visual Studio Enterprise 17.6.0 Preview 7.0. Repro on Android platform with sample project.

ReproductionProjectBug8265_PickerText

Can you verify this issue with the latest version just to make sure

pauldiston commented 6 months ago

This issue seems to be still present in 8.0.14.

DeepWorksStudios commented 6 months ago

This issue seems to be still present in 8.0.14.

I know but no body from the dev team cares 🤷🏻‍♂️

I gave up on Maui and stoped updating my issues let alone reporting new ones

CleverSoftwarePoland commented 3 weeks ago

Any news on this problem?

DeepWorksStudios commented 2 weeks ago

i wonder if they worked on this issue or not