-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Android] When a user taps off of an input control the keyboard no longer closes #12002
Comments
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. |
I am using Android Entry Keyboard bug fixed like this. |
Android is currently using it temporarily. |
@pulmuone |
I pushed again using Handler in HandlerEntryView2.xaml. |
I make one solution based on this one but without keyboard flicker everytime you repress it
The explanation is simple, if focused it will set the touch listener If KeepFocus is not set, the dispatch touch will unfocus There is still an issue which is if you touch another entry, it will still flicker but every other instance it working fine, might need to tune somthing to make it work at 100% Hope I could be of some use |
I've put together a behavior here that seems to work alright and cover most cases. T https://github.com/PureWeen/ShanedlerSamples/tree/main/ShanedlerSamples/Library <Entry Placeholder="Text Field" Text="Starting text" WidthRequest="300">
<Entry.Behaviors>
<local:TapToCloseBehavior></local:TapToCloseBehavior>
</Entry.Behaviors>
</Entry> public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder();
builder
.UseMauiApp<App>()
.ConfigureShanedler()
.ConfigureFonts(fonts =>
{
fonts.AddFont("OpenSans-Regular.ttf", "OpenSansRegular");
fonts.AddFont("OpenSans-Semibold.ttf", "OpenSansSemibold");
});
return builder.Build();
}
Some version of this will probably make it into the keyboard |
this still doesn't work in .net 7 |
Can you tell when this will be fixed? |
Same issue with latest .NET MAUI |
Out of curiosity, why do most of the solutions you all have worked up here also clear focus? Why isn't just closing the keyboard sufficient? It feels jarring to the user to just completely remove/change the focus unless that's a clear transition for the user. For example, here's a gif of how ClearFocus works on an API 21 device. It just moves focus to the top entry. I tested on API 30+ and on those it clears the focus but that still feels confusing. Clearing the focus resets focus to zero so now if the user has a keyboard attached, they are in an unexpected place. The only way (that I know of)) to completely clear the focus from the entries is to move the focus to a non-interactive element. So, in If someone can provide a sample or a platform/popular app that demonstrates this behavior, can you please link to it here? The closest I can find is google maps, where clicking the results closes the keyboard, but that's because it's moving the focus to the search results. Which makes sense. iOS handles this behavior slightly "better". In iOS if you "clear focus" it remembers where you were. To be clear, we are adding a way to click outside an entry and close the keyboard it just won't clear the focus. In the meantime, please test with my behaviors. let me know how well they work/don't work. |
The problem isnt the views themselves but when an entry is a children of a scrollview (for example). |
Are you referring to the behaviors I have in my sample project? They work fine when nested in a ScrollView. The sample I'm testing them on has them nested in ScrollView. |
you can try to use my example of the issue here https://github.com/taz4270/ScrollNFocus-Example PS: Im using the latest .NET 7 MAUI (7.0.52) |
It looks like you've rolled your own solution here. Did you try with the behaviors I created? |
Proposal discussion to release this behavior as part of the community toolkit This way we can provide the behavior faster and then also refine/add to it out of band from MAUI. |
Does not work with Community Toolkit Popup. |
This works fine if i click outside an entry. But it breaks the functionality of the clear button in an entry. On click of clear button, entry gets focused again and doesn't clear the text. |
Fixed by #16530 |
Description
Copied from #6933 (comment)
In
XF
when you click/tapped outside of a focused entry the entry would lose focus and the keyboard would close. This behavior wasn't copied over toMAUI
because the implementation onXF
was very wrong and broke accessibility.If we decide to "fix" this for MAUI .NET 7 we should not implement the "Unfocus" behavior and only make it so that it closes the keyboard.
Reasons to fix
Forms
so we can match behavior for users migrating.Forms
in NET7 and then provide an API in NET8 that lets users toggle this behavior on/off foriOS
andAndroid
XF
. At a later point we might have enough API surface for users to do this themselves easily but currently they do not.Reasons not to fix for .NET 7
iOS
andAndroid
Concerns
The way this behavior worked in XF was to make the entire page clickable which made apps completely inaccessible. Anybody wanting to pass WCAG certification with an XF app were forced to write custom code to disable this behavior. The only place where I've seen this behavior is if the area you click off to is interactable in some format. For example, the maps app if you click off to the results but if you test with the WIFI app or contacts app they don't work like this. If you want to add this behavior yourself I think this would be the best way to go about it https://stackoverflow.com/a/28939113 so you don't confuse TalkBack.
I think we need to flesh out the use cases here a bit more so we can provide guidance or additional APIs to give people the ability to make these choices if they want to but we're not going to make this the default behavior unless provided some examples that are accessible and preferable over the default Android behavior or if it can demonstrated that .NET MAUI breaks Android platform defaults.
Steps to Reproduce
Link to public reproduction project repository
N/A
Version with bug
6.0 Release Candidate 2 or older
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android
Did you find any workaround?
PageHandler.CreatePlatformView
and return your ownContentViewGroup
. Then inside theContentViewGroup
overrideDispatchTouch
and from there close the keyboardRelevant log output
No response
The text was updated successfully, but these errors were encountered: