SoftKeyboardInterceptionModifierNode


Implement this interface to create a Modifier.Node that can intercept hardware Key events before they are sent to the software keyboard. This can be used to intercept key input from a DPad, or physical keyboard connected to the device and is not applicable to input that is sent to the soft keyboard via spell check or autocomplete.

The event is routed to the focused item. Before reaching the focused item, onPreInterceptKeyBeforeSoftKeyboard is called for parents of the focused item. If the parents don't consume the event, onPreSoftwareKeyboardKeyEvent is called for the focused item. If the event is still not consumed, onInterceptKeyBeforeSoftKeyboard is called on the focused item's parents.

Summary

Public functions

Boolean

This function is called when a KeyEvent is received by this node during the upward pass.

Cmn
Boolean

This function is called when a KeyEvent is received by this node during the downward pass.

Cmn

Inherited functions

From androidx.compose.ui.node.DelegatableNode
open Unit

Invoked when the density changes for this node.

Cmn
open Unit

Invoked when the layout direction changes for this node.

Cmn

Inherited properties

From androidx.compose.ui.node.DelegatableNode
Modifier.Node

A reference of the Modifier.Node that holds this node's position in the node hierarchy.

Cmn

Public functions

onInterceptKeyBeforeSoftKeyboard

fun onInterceptKeyBeforeSoftKeyboard(event: KeyEvent): Boolean

This function is called when a KeyEvent is received by this node during the upward pass. While implementing this callback, return true to stop propagation of this event. If you return false, the key event will be sent to this SoftKeyboardInterceptionModifierNode's parent.

onPreInterceptKeyBeforeSoftKeyboard

fun onPreInterceptKeyBeforeSoftKeyboard(event: KeyEvent): Boolean

This function is called when a KeyEvent is received by this node during the downward pass. It gives ancestors of a focused component the chance to intercept an event. Return true to stop propagation of this event. If you return false, the event will be sent to this SoftKeyboardInterceptionModifierNode's child. If none of the children consume the event, it will be sent back up to the root using the onPreInterceptKeyBeforeSoftKeyboard function.