community icon indicating copy to clipboard operation
community copied to clipboard

[WIP] [build wheel] Introduce TextInput provider (Android, iOS and "Legacy" Window provider)

Open misl6 opened this issue 1 year ago • 0 comments

Maintainer merge checklist

  • [ ] Title is descriptive/clear for inclusion in release notes.
  • [ ] Applied a Component: xxx label.
  • [ ] Applied the api-deprecation or api-break label.
  • [ ] Applied the release-highlight label to be highlighted in release notes.
  • [ ] Added to the milestone version it was merged into.
  • [ ] Unittests are included in PR.
  • [ ] Properly documented, including versionadded, versionchanged as needed.

A little brief

This is definitely not intended to be merged as-is, instead is just a POC for supporting additional textinput methods. (The idea is to treat the textinput provider as other core providers we have in Kivy (Camera, Window, ...))

It works (but sometimes it crashes, as I needed to achieve a result, and I did not took care about everything 😀) on both iOS and Android with platform-specific providers, and offers the same support as before with window-provider events on other platforms.

https://user-images.githubusercontent.com/8177736/235317494-55af9ce6-c0eb-4ee4-bc65-f126d8762208.mp4

Why this is needed?

  • The window provider (SDL in that case) does not have (and is not required to?) all the events and methods to access the complete feature set that the (mostly mobile) platforms offer.
  • We currently only support basic text input methods (we basically receive keystrokes from the keyboard and change the TextInput widget text property accordingly). This may be fine for languages that do not require an Input Method Editor (IME) to input text.
  • The window provider (SDL in that case) is not able to handle multiple TextInput fields at the same time. That breaks the keyboard suggestions for us.
  • The current implementation does not allow us to handle autofills (E.g. for password managers)
  • The current implementation does not allow us to handle accessibility features on textinputs.

Some related issues:

  • https://github.com/kivy/kivy/issues/8172
  • https://github.com/kivy/kivy/issues/7741
  • https://github.com/kivy/kivy/issues/6898
  • https://github.com/kivy/kivy/issues/2694
  • https://github.com/kivy/kivy/issues/5739
  • https://github.com/kivy/kivy/issues/4605
  • https://github.com/kivy/kivy/issues/8185
  • https://github.com/kivy/kivy/issues/7415
  • https://github.com/kivy/kivy/issues/7294
  • https://github.com/kivy/kivy/issues/7184
  • https://github.com/kivy/kivy/issues/7053
  • https://github.com/kivy/kivy/issues/8232
  • https://github.com/kivy/kivy/issues/7375
  • https://github.com/kivy/kivy/issues/8267
  • https://github.com/kivy/kivy/issues/8272
  • possibly many other issues 😭

How we tried to fix this issue in past:

  • Disabling the keyboard suggestions (spoiler: does not work for all the soft keyboards)
  • Using textinput events from SDL (spoiler: these events are not enough to handle everything)

TODO:

  • [ ] Re-think FocusBehavior, possibly without breaking the current API. The keyboard needs (and should) be handled by the textinput provider.
  • [ ] ...

misl6 avatar Apr 29 '23 15:04 misl6