unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
8.97k stars 730 forks source link

[Epic] Keyboard input #6074

Open carlh98 opened 3 years ago

carlh98 commented 3 years ago

What would you like to be added:

Support for keyboard input in Uno Platform.

Why is this needed:

Keyboard input and productivity scenarios.

Requirements

Related issues

For which Platform:

All

Anything else we need to know?

Internal issue: https://dev.azure.com/nventive/Maitre%20de%20Chai/_workitems/edit/218831

jeromelaban commented 3 years ago

@dr1rrb @carldebilly I think we can't support KeyDown for arbitrary controls on iOS, right ? Only on TextBox ?

carldebilly commented 3 years ago

Was talking with @MartinZikmund today specifically about this... and it seems he found a way to have them.

MartinZikmund commented 3 years ago

@jeromelaban at least for the hardware keyboard, I tested with iPad, and was able to capture key events at the root view controller level. Seems to be a 13.4+ feature - https://www.swiftbysundell.com/tips/handling-keyup-and-keydown-events/. But all iOS users update immediately anyway, so definitely seems worth adding!

Swift by Sundell
Handling keyUp and keyDown events on iOS 13.4 and later | Swift by Sundell
How to observe iOS 13.4’s new granular keyboard events.
MartinZikmund commented 3 years ago

In case of Android, we could also capture keyboard events at the activity level. Even though it does not include soft keyboard presses as Carl mentioned, the keyboard events are still most useful for hardware keyboard anyway. And it would open doors for things like keyboard shortcuts and whatnot

carldebilly commented 3 years ago

In case of Android, we could also capture keyboard events at the activity level. Even though it does not include soft keyboard presses as Carl mentioned, the keyboard events are still most useful for hardware keyboard anyway. And it would open doors for things like keyboard shortcuts and whatnot

Anyway I suspect those events on iOS won't work when coming from a software on-screen keyboard neither...

MartinZikmund commented 3 years ago

@carldebilly quite possible, but still better then no support 👍 . I would say most scenarios where KeyDown handling (outside of TextBox) is needed, will be most relevant for hardware keyboard anyway.

carlh98 commented 3 years ago

Removed from blocker, because design was changed back to previous iteration