community icon indicating copy to clipboard operation
community copied to clipboard

Incorrect behavior keyboard_suggestions

Open idevo89 opened this issue 4 years ago • 8 comments
trafficstars

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

ezgif com-video-to-gif

idevo89 avatar Jan 19 '21 23:01 idevo89

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?

matham avatar Jan 19 '21 23:01 matham

I'll take a look

dwmoffatt avatar Jan 20 '21 01:01 dwmoffatt

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?

misl6 avatar Feb 11 '21 12:02 misl6

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.

dwmoffatt avatar Feb 11 '21 16:02 dwmoffatt

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.

misl6 avatar Sep 12 '21 16:09 misl6

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.

Alspb avatar Jan 06 '22 01:01 Alspb

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

karmabIT avatar Apr 21 '22 10:04 karmabIT

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 :)

NomadDemon avatar Apr 22 '22 08:04 NomadDemon

Kivy master Python-for-android develop

No suggestion or swipe.

brvier avatar Oct 08 '22 09:10 brvier

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()

brvier avatar Oct 17 '22 15:10 brvier

Fixed via https://github.com/kivy/python-for-android/pull/2692

misl6 avatar Nov 28 '22 19:11 misl6