Skip to content
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

ITextInput.ShowSoftInputOnFocus to indicate if you want the keyboard to display when a control becomes focused #11562

Open
Tracked by #16799 ...
PureWeen opened this issue Nov 22, 2022 · 2 comments
Labels
area-keyboard Keyboard, soft keyboard proposal/open

Comments

@PureWeen
Copy link
Member

PureWeen commented Nov 22, 2022

Description

In Xamarin.Forms we always just assumed that when a user called focus on a element that they wanted the keyboard to show up. In .NET MAUI we haven't carried this behavior over yet because we wanted to audit it with regards to accessibility. For the most part this seems like harmless behavior to add to our Input fields. That being said it's always ideal that users can configure side effects.

I'm not sure if this property can be made functional on iOS and WinUi as well.

Additional research should be done on the name. The gut reaction might be to call the property ShowKeyboardOnFocus but we should explore if that doesn't fully fit the spectrum of inputs this can influence.

Public API Changes

ITextInput

If ShowSoftInputOnFocus is set to true then when the user calls IView.Focus() we will pop the keyboard open for them on Android. Since currently on android calling Focus doesn't open the keyboard for the user.

For .NET7 we could add this as a new interface internally and then make it a public API for .NET8

interface ITextInput
{
    // not sure if this can be implemented against WinUI/iOS
    // By default the property will be set to true
    // if this is false it doesn't mean the keyboard will close on focus it just means nothing will happen
     bool ShowSoftInputOnFocus { get; } 
}

Intended Use-Case

Idea 1

<Entry ShowSoftInputOnFocus="true" x:Name="entryDoShow" />
<Entry ShowSoftInputOnFocus="false" x:Name="entryDontShow" />
entryDoShow.Focus(); // Soft keyboard will always display
entryDontShow.Focus(); // Soft keyboard will not display

Idea 2

We use attached properties for a general "Keyboard/InputManager"

KeyboardManager.ShowSoftInputOnFocus
KeyboardManager.AutoScrollEnabled
KeyboardManager.CloseKeyboardWhenClickOff
KeyboardManager.Other
KeyboardManager.DisableAnyMauiFeaturesOfKeyboard

@PureWeen PureWeen added legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor area-keyboard Keyboard, soft keyboard labels Nov 22, 2022
@PureWeen PureWeen added this to the Backlog milestone Nov 22, 2022
@ghost
Copy link

ghost commented Nov 22, 2022

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.

@Simoneye1011
Copy link

hello,i do similar event in maui,but there is no keyup event,do you knoow some way of that ?thanks

@samhouts samhouts modified the milestones: Backlog, .NET 8 Jul 5, 2023
@samhouts samhouts added backport/approved After some discussion or review, this PR or change was approved to be backported. and removed legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor backport/approved After some discussion or review, this PR or change was approved to be backported. labels Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-keyboard Keyboard, soft keyboard proposal/open
Projects
None yet
Development

No branches or pull requests

3 participants