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.21k stars 1.75k forks source link

The iOS keyboard is not fully retracted and requires an extra click on the “Done” button #22286

Open ninachen03 opened 6 months ago

ninachen03 commented 6 months ago

Description

The iOS keyboard is not fully retracted and requires an extra click on the “Done” button.

Steps to Reproduce

  1. Deploy https://devdiv.visualstudio.com/Pkgs/_git/VS.TestAssets.Xaml?path=/Assets/Projects/ManualMauiTests to iOS simulator
  2. Click or tap on category 'D' for 'RefreshView'.
  3. Select the D4 or any editor page.
  4. I/O ->Keyboard->Toggle Software keyboard ->Software keyboard is showing
  5. Press any key on physical keyboard->The soft keyboard exits, but there is still a "Done" button in the lower right corner, which needs to be clicked to disappear completely. Done

Link to public reproduction project repository

https://devdiv.visualstudio.com/Pkgs/_git/VS.TestAssets.Xaml?path=/Assets/Projects/ManualMauiTests

Version with bug

8.0.40-nightly.10612+sha.752eed7129-azdo.9538080

Is this a regression from previous behavior?

This bug is not a regression, it can be reproduced in the latest stable release :8.0.3

Affected platforms

iOS

Did you find any workaround?

Added below code to MauiProgram.cs file image

#if IOS
Microsoft.Maui.Handlers.EditorHandler.Mapper.AppendToMapping("EditorChange", (handler, view) =>
{
    handler.PlatformView.InputAccessoryView = null;
});
#endif

Relevant log output

No response

github-actions[bot] commented 6 months ago

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

drasticactions commented 6 months ago

This is because the hardware keyboard is enabled for the simulator, so it'll show the "Done" button always when the editor is selected since it's an added element to the InputAccessoryView. If you ran it on a device without a hardware keyboard, it shouldn't appear.

That workaround would remove it from all uses of the keyboard though, unless you add it back for the software keyboard and remove it for the hardware one by detecting it. Also note that this InputAccessoryView is added by MAUI as part of its keyboard implementation, it's not the default for iOS. CC @tj-devel709.

gabsamples6 commented 6 months ago

Hi this one https://github.com/dotnet/maui/issues/17819 is causing issues for us and users complained that they have 2 press the button twice in iOS

We have an entry where a user can input an amount and a button exactly like the pic in 17819

  1. they input the amount
  2. press next button (does nothing)
  3. keyboard now hides and button does nothing
  4. press button now and works..
  5. so they have to press it twice...

hope this can be addressed as we have no found any workaround

thanks

mattleibow commented 5 months ago

This issue is saying the accessory view is sticking around when you type on the host OS when using a simulator... which is not a real issue a user will hit since they have real devices with no host laptop.

But, can this issue occur in a normal app? Is there a real scenario that this could occur in?

developer9969 commented 5 months ago

@mattleibow we are having the same issue where a double tap is required on a real iOS device and because the issue is linked to https://github.com/dotnet/maui/issues/17819 would fixing this issue also fix https://github.com/dotnet/maui/issues/17819?

Works on android (no double tap)

mattleibow commented 5 months ago

I think this issue is not that we have to double tap but rather the Done button sticks around and has to be tapped to make it disappear.

mattleibow commented 2 months ago

This is causing an issue in this PR too: https://github.com/dotnet/maui/pull/20505

Instead of the keyboard going away, this is a non-editable editor that receives focus, but since it is not editable the keyboard does not appear and the done button does for some reason.