onKeyEvent
fun Modifier.onKeyEvent(propagation: InputResult, filter: KeyboardInputFilter = KeyboardInputFilter(), action: UiSession.(KeyboardEvent) -> Unit): Modifier(source)
Subscribes to typed keyboard notifications with a fixed immediate dispatch result. Only events matching filter invoke action or cross a remote connection; other events continue propagation. The handler runs on the screen owner thread, on the hosting server or proxy when the screen is remote. propagation is decided locally without waiting for that handler; dynamic result callbacks use the other overload.
Adds a focused callback for every key press and release.
The modifier makes its logical component focusable, retains callback until replacement or disposal, and invokes it synchronously on the tree thread.
Return
a modifier with the active callback appended nearest the component.
Parameters
callback
focused key callback deciding propagation.