FocusTargetModifierNode

Interface

Common
sealed interface FocusTargetModifierNode : DelegatableNode

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

Properties

Common
val focusState: FocusState

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.

Common
var focusability: Focusability

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.

Functions

fun requestFocus(): Boolean

Request focus for this node.

Returns

true if focus was successfully requested
fun requestFocus(focusDirection: FocusDirection = FocusDirection.Enter): Boolean

Request focus for this node.

Parameters

focusDirectionThe direction from which the focus is being requested

Returns

true if focus was successfully requested