toga icon indicating copy to clipboard operation
toga copied to clipboard

Add API to control spell checkers and other platform-provided text input assistants

Open freakboy3742 opened this issue 1 year ago • 4 comments

What is the problem or limitation you are having?

It is common for test input fields to have spellcheck helpers, especially on mobile platforms. This is extremely useful when the input is human-readable text, but if an input is something like an input of a family name, or ID number, or anything else that is decidedly not a natural language word, red underlined words and spell check corrections can be something between an annoyance and an active hindrance.

Describe the solution you'd like

TextInput and MultilineTextInput should have a mechanism to disable auto spell check.

A boolean flag to the TextInput constructor (spell_checking=False) would be sufficient to control spelling specifically.

Describe alternatives you've considered

It may be worth investigating if there are other input features that we might want to turn off (e.g., autocorrect, autocomplete, autocapitalisation, predictive text). Depending on how many of these features exist, and how common they are across platforms, it might be worthwhile considering adding support for those features as well.

If a platform doesn't provide the feature at all, the feature should be ignored (and documented as such as a platform quirk).

Additional context

Originally reported as #2801.

In that ticket, @rmartin16 provided the functional implementation for Android:

text_input = toga.TextInput()

if toga.platform.current_platform == "android":
    from android.text import InputType
    text_input._impl.native.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS)

The InputType enum seems to have a number of other options that can be disabled.

iOS provides spellCheckingType, autocorrectionType and a number of other properties for configuration automated tools.

freakboy3742 avatar Sep 01 '24 23:09 freakboy3742

@freakboy3742 can you assign me this issue

raghulchandramouli avatar Jan 16 '25 17:01 raghulchandramouli

We don't use the GitHub assignment feature in this project – if you want to start working on an issue, posting a comment is enough.

mhsmith avatar Jan 16 '25 22:01 mhsmith

Hello! Had this been resolved? Otherwise I was hoping to work on this issue.

Rocygel avatar Feb 24 '25 14:02 Rocygel

I'm not sure if @raghulchandramouli has done anything – if they don't reply to this message within a few days, feel free to start working on it.

mhsmith avatar Feb 24 '25 21:02 mhsmith