New Compose Multiplatform components arrived on Composables UICheck it out →

Modifier in Compose Foundation

onFocusedBoundsChanged

Common

Calls [onPositioned] whenever the bounds of the currently-focused area changes. If a child of this node has focus, [onPositioned] will be called immediately with a non-null [LayoutCoordinates] that can be queried for the focused bounds, and again every time the focused child changes or is repositioned. When a child loses focus, [onPositioned] will be passed null.

When an event occurs, it is bubbled up from the focusable node, so the nearest parent gets the event first, and then its parent, etc.

Last updated:

Installation

dependencies {
   implementation("androidx.compose.foundation:foundation:1.7.0-beta04")
}

Overloads

@ExperimentalFoundationApi
fun Modifier.onFocusedBoundsChanged(onPositioned: (LayoutCoordinates?) -> Unit)