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

Disable text input suggestions and auto-complete #16579

Open
jcsawyer opened this issue Aug 2, 2024 · 0 comments · May be fixed by #17815
Open

Disable text input suggestions and auto-complete #16579

jcsawyer opened this issue Aug 2, 2024 · 0 comments · May be fixed by #17815

Comments

@jcsawyer
Copy link

jcsawyer commented Aug 2, 2024

Is your feature request related to a problem? Please describe.

I have an app transmitting text typed in on a textbox directly to another app.
The suggestions and auto complete do not work this this approach.

Describe the solution you'd like

TextInputOptions provides an option named HideSuggestions or something similar that when set on a text box, the keyboard does not show the autocomplete/word suggestions above the keys.

Describe alternatives you've considered

I was able to use TextInputOptions.Multiline="True" TextInputOptions.ReturnKeyType="Return" TextInputOptions.ContentType="Password" on the textbox to achieve mostly what I'm after, which works fine on Android but on iOS displays a "passwords" button above the keyboard which isn't ideal.

Alternatively, I could buffer text to send, but I want to be able to do both.

Additional context

I was looking in the code and did a rough change to see how it might work.
After adding a HideSuggestions property to TextInputOptions, I updated AndroidInputMethod with the following:

if (outAttrs.InputType is InputTypes.ClassText && options.HideSuggestions)
    outAttrs.InputType = InputTypes.TextVariationVisiblePassword | InputTypes.TextFlagNoSuggestions;

This however doesn't really result in any difference on the Android side as it turns out most keyboards don't really pay attention to the TextFlagNoSuggestsions flag. One of the downsides with either of these approaches is that you lose the ability to use emojis (not the end of the world if this isn't achievable).
Screenshot 2024-08-02 at 16 47 10

On the iOS side, I updated TextInputResponder.Properties.cs with:

[Export("autocorrectionType")]
public UITextAutocorrectionType AutocorrectionType =>
    _view._options == null ?
        UITextAutocorrectionType.Yes :
        _view._options.HideSuggestions ?
            UITextAutocorrectionType.No :
            UITextAutocorrectionType.Yes;

and

[Export("spellCheckingType")]
public UITextSpellCheckingType SpellCheckingType =>
    _view._options == null ?
        UITextSpellCheckingType.Yes :
        _view._options.HideSuggestions ?
            UITextSpellCheckingType.No :
            UITextSpellCheckingType.Yes;

This gives me the ideal keyboard that I require.
Screenshot 2024-08-02 at 16 50 15

@jcsawyer jcsawyer linked a pull request Dec 21, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant