community
community copied to clipboard
Incorrect behavior keyboard_suggestions
Software Versions
- Python: 3.8
- OS: Android 9
- Kivy: master
- Kivy installation method: python-for-android develop with kivy==master
Describe the bug Keyboard suggestions for TextInput do not work correctly on android. Words are inputted twice when you use a suggestion or swipe as you can notice when you delete the words or press enter. Setting keyboard_suggestions to false does not deactivate suggestions.
Expected behavior Keyboard suggestions or swiping should input words correctly and it should be possible to deactivate the suggestions feature with keyboard_suggestions set to false.
To Reproduce
from kivy.app import App
from kivy.lang import Builder
kv = """
Screen:
TextInput:
size_hint_y: None
height: dp(45)
hint_text: "keyboard_suggestions: False"
write_tab: False
keyboard_suggestions: False
pos_hint: {"top": 0.9}
TextInput:
size_hint_y: None
height: dp(45)
hint_text: "keyboard_suggestions: True"
write_tab: False
keyboard_suggestions: True
pos_hint: {"top": 0.7}
"""
class Test(App):
def build(self):
return Builder.load_string(kv)
Test().run()
Gif

I'm wondering if it's due to https://github.com/kivy/kivy/pull/7231. Can you try a commit before that? Or maybe 2.0.0?
@dwmoffatt could you take a look?
I'll take a look
GBoard:
- Issue confirmed when using swipe or suggestions.
Samsung Keyboard:
- The first inputted character, keeps into TextInput.
Reverting #7231 fixed the issue.
It could potentially disrupt the UX for multiple users. @dwmoffatt any news?
I think I know what the problem is. There are some other variations/flags that need to get set for some of the autocomplete and suggestions to work properly based on how you are entering the data.
https://developer.android.com/reference/android/text/InputType
I haven't had a chance to try anything out yet. Hopefully next week I will have some time.
Update:
Looks like some device vendors and keyboards are de-facto ignoring the InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS flag, so we can't really rely on this one to disable suggestions.
I'd also add that for Gboard and other keyboards its built-in "Copy" and "Paste" buttons don't work: "Copy" is disabled even if text is selected, "Paste" just does nothing. Probably "Copy" just can't detect that something is selected, but seems that "Paste" should work fine.
Hi, I would like to help you in solving the poblem, since I need it to find a solution quickly. May you tell me which files (and/or part of codes) I have to check and modify (including the event on keyboard) to try to find a solution?
Thank you
i have same problem kivy 2.1.0 on Android [2 differend phones, 4y difference + gboard] if i go to next word it keep repeating last suggested on spacebar
iam too short to help with keyboard or even files where to look :(
i owe you beer if you fix it somehow :)
Kivy master Python-for-android develop
No suggestion or swipe.
Indeed should be (input_type:"text" added) :
from kivy.app import App
from kivy.lang import Builder
kv = """
Screen:
TextInput:
size_hint_y: None
height: dp(45)
hint_text: "keyboard_suggestions: False"
write_tab: False
keyboard_suggestions: False
pos_hint: {"top": 0.9}
TextInput:
size_hint_y: None
height: dp(45)
hint_text: "keyboard_suggestions: True"
input_type: "text"
write_tab: False
keyboard_suggestions: True
pos_hint: {"top": 0.7}
"""
class Test(App):
def build(self):
return Builder.load_string(kv)
Test().run()
Fixed via https://github.com/kivy/python-for-android/pull/2692