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

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

Open
freakboy3742 opened this issue Sep 1, 2024 · 0 comments
Labels
enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start!

Comments

@freakboy3742
Copy link
Member

freakboy3742 commented Sep 1, 2024

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 freakboy3742 added enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start! labels Sep 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features. good first issue Is this your first time contributing? This could be a good place to start!
Projects
None yet
Development

No branches or pull requests

1 participant