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

[Spec] Proposed Keyboard/Mouse Specs for .NET9 #16799

Open
8 tasks
PureWeen opened this issue Aug 16, 2023 · 1 comment
Open
8 tasks

[Spec] Proposed Keyboard/Mouse Specs for .NET9 #16799

PureWeen opened this issue Aug 16, 2023 · 1 comment
Labels
area-keyboard Keyboard, soft keyboard proposal/open
Milestone

Comments

@jonmdev
Copy link

jonmdev commented May 8, 2024

If you are looking at fixing the soft keyboard to give us better and more comprehensive control, I suggest you also consider also adding to the LifeCycle for Android:

onKeyDown, onKeyUp, dispatchKeyEvent, and/or dispatchKeyEventPreIme to capture the close command triggered by the back button on Android to close the soft keyboard in Android.

Currently these are all missing from the Lifecycle as per: #18535

This prevents us from reacting to this properly except by querying the height of the keyboard by Android methods and reacting to it manually if it goes from >0 in one frame to == 0 in the next (which is tedious).

I think any good Keyboard API should include some combination of the following:

1) Open/Close Events

  • keyboardOpeningStartedEvent
  • keyboardOpeningFinishedEvent
  • keyboardClosingStartedEvent
  • keyboardClosingFinishedEvent

Currently I track such events based on monitoring the height of the keyboard in Android frame by frame and whether it is growing/shrinking or stable frame by frame. iOS is a bit easier. Perhaps there is no better way in Android. Not sure if you'd want to implement something so hacky.

Simpler would just be:

  • keyboardHeightChangedEvent()

And we can infer from that what we can. Though this is less useful overall.

2) Keyboard Height

  • getKeyboardHeight() or getKeyboardSize()

Should be gettable at any time, and also passed through event args for open/close events if using those too.

3) Commands to Manually Open (or At Least Close) Keyboard

  • openSoftKeyboard()
  • closeSoftKeyboard()

This would prevent needing platform based code like I described to figure this stuff out for each user.

@PureWeen PureWeen modified the milestones: .NET 9 Planning, Backlog Jul 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-keyboard Keyboard, soft keyboard proposal/open
Projects
None yet
Development

No branches or pull requests

4 participants