requestFocusForChildInRootBounds

Function

Common
fun DelegatableNode.requestFocusForChildInRootBounds(
    left: Int,
    top: Int,
    right: Int,
    bottom: Int,
): Boolean

Attempts to request focus for the most suitable focusable child node that overlaps with the given rect area (left, top, right, bottom).

The rectangle is interpreted in the coordinate space relative to the compose root. See androidx.compose.ui.layout.LayoutCoordinates.localToRoot for converting local coordinates to the root coordinates.

Parameters

leftis the left edge of the rectangle, in pixels relative to the compose root.
topis the top edge of the rectangle, in pixels relative to the compose root.
rightis the right edge of the rectangle, in pixels relative to the compose root.
bottomis the bottom edge of the rectangle, in pixels relative to the compose root.

Returns

true if a matching child was found and focus was granted; false if no such child exists, it is already focused, or the focus request failed.