FocusTargetModifierNode


This modifier node can be delegated to in order to create a modifier that makes a component focusable.

Summary

Public functions

Boolean
requestFocus(focusDirection: FocusDirection)

Request focus for this node.

Cmn

Public properties

FocusState

The FocusState associated with this FocusTargetModifierNode.

Cmn
Focusability

The Focusability for this node.

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

requestFocus

fun requestFocus(focusDirection: FocusDirection = FocusDirection.Enter): Boolean

Request focus for this node.

Parameters
focusDirection: FocusDirection = FocusDirection.Enter

The direction from which the focus is being requested

Returns
Boolean

true if focus was successfully requested

Public properties

focusState

val focusStateFocusState

The FocusState associated with this FocusTargetModifierNode. When you delegate to a FocusTargetModifierNode, instead of implementing FocusEventModifierNode, you can get the state by accessing this variable.

focusability

var focusabilityFocusability

The Focusability for this node.

Note that parent FocusPropertiesModifierNodes that set FocusProperties.canFocus take priority over this property.

If the current focus state would be affected by a new focusability, focus will be invalidated as needed.