Sanniv Khare 7 min read

Compose 1.13 removed onFocusedBoundsChanged: what to use on TV

Compose 1.13 removed onFocusedBoundsChanged: what to use on TV

If a Compose TV screen used Modifier.onFocusedBoundsChanged to scroll the focused card into view or to move a focus highlight, it stops working with Compose 1.13 (stable 18 Nov 2026, BOM 2026.11.01). The replacement depends on the job: to scroll a focused item into view, pair Modifier.onFocusChanged with BringIntoViewRequester; to know where focus is, ask FocusTargetModifierNode.getFocusedRect() when you need the rectangle. Lazy lists and Modifier.verticalScroll already scroll to focused content on their own and need nothing.

One detail the release post does not spell out: in the androidx source the deprecation is now DeprecationLevel.ERROR, so your own code that calls it stops compiling, while a library compiled against 1.12 still links and silently gets a modifier that does nothing. The second case is the one to hunt for.

Why we did this: BMDB’s Android TV app is a D-pad browse screen of poster rows, the kind of screen this modifier was used for. This post is a source review of androidx (commits of July 2026) and a check of Google’s TV sample apps, with the replacements taken from Google’s own code.

What changed in Compose 1.13

The Compose November 2026 release post says the modifier “was deprecated in Compose 1.12, and in 1.13 its implementation has been removed, meaning it has no effect if the modifier is run”. The Compose Foundation release notes carry the same change under 1.13.0-alpha01 (12 Aug 2026): “Using this modifier now no-ops.”

The change itself is androidx commit 80548b1f12 of 9 July 2026, whose release note is word for word the 1.13.0-alpha01 note. We read the diff of FocusedBounds.kt:

Compose 1.12 Compose 1.13
Deprecation level default (warning) ERROR
Body adds an observer node this
Callback called on focus and position changes, best effort never called
Your code calling it compiles with a warning compile error
A library built against 1.12 calling it works links, does nothing

The diff also deletes the observer node, the 497-line FocusableBoundsTest.kt, and the code in Focusable.kt that reported every focusable’s position to the nearest observer. Nothing is left to call your lambda.

onFocusedBoundsChanged in Compose 1.12 and the onFocusChanged plus BringIntoViewRequester pattern in 1.13

The scroll case before and after. The right side follows JetStream’s MovieDetails screen.

Replacement 1: scroll a focused item into view

This is what most TV screens used the modifier for: a hero area or a custom row that must move when the D-pad lands on something inside it. The release post’s advice is to “pair onFocusChanged with BringIntoViewRequester“, and Google’s JetStream sample already does exactly that in MovieDetails.kt:

val bringIntoViewRequester = remember { BringIntoViewRequester() }
val coroutineScope = rememberCoroutineScope()

Box(
    modifier = Modifier
        .fillMaxWidth()
        .height(432.dp)
        .bringIntoViewRequester(bringIntoViewRequester)
) {
    // ...
    WatchTrailerButton(
        modifier = Modifier.onFocusChanged {
            if (it.isFocused) {
                coroutineScope.launch { bringIntoViewRequester.bringIntoView() }
            }
        },
        goToMoviePlayer = goToMoviePlayer
    )
}

The requester sits on the area you want visible (here the whole 432 dp hero box, not just the button), and the focus callback asks for it. Jetcaster’s TV PlayerScreen.kt in compose-samples uses the same two APIs.

Before you add this anywhere, check whether the container already does it. The release post notes that “built-in scrolling containers such as LazyColumn and Modifier.verticalScroll already bring focused content into view without this API”. A LazyRow of posters needs no extra code.

Replacement 2: know where focus is, on demand

Some screens used the old callback for something other than scrolling: a focus ring that slides between cards, a preview panel that follows the focused poster, analytics on which tile was focused. For these, Compose now wants you to pull the rectangle when you need it, instead of being pushed every change.

getFocusedRect() is an extension on FocusTargetModifierNode in FocusTargetModifierNode.kt. Its KDoc says it returns the focus area of the focused node under that node “in this node’s coordinates”, and null when nothing under it is focused or the node is detached.

The pattern comes from Google’s rewritten FocusedBoundsDemo.kt, changed in the same commit: a DelegatingNode that delegates a FocusTargetModifierNode with Focusability.Never, so it never takes focus itself but can answer for its children.

A DelegatingNode with a FocusTargetModifierNode that is never focusable, returning getFocusedRect()

The node at the heart of Google’s demo, trimmed.

private class FocusedRectNode : DelegatingNode() {
    private val focus = delegate(FocusTargetModifierNode(Focusability.Never))

    // Rect of the focused descendant in this node's coordinates, or null.
    fun focusedRect(): Rect? = focus.getFocusedRect()
}

Google’s demo wraps the node in a ModifierNodeElement, hands a provider lambda to the composable in onAttach, and reads it inside withFrameNanos, once per frame. On a TV screen you can be cheaper: read it from the onFocusChanged callback of the row, or when the D-pad key event arrives, since focus only moves on input. Treat the snippet as a starting point and compile it against Compose 1.13 in your project.

Who still calls it

We cloned android/tv-samples (JetStream and the TV Material catalog, main of 18 Nov 2026), android/compose-samples (main of 16 Nov 2026) and the tv/ libraries in androidx-main (20 Nov 2026), and searched them.

grep for onFocusedBoundsChanged in tv-samples, compose-samples and androidx/tv returns 0 files

Real output: no sample and no androidx TV library calls the removed modifier.

Google’s samples and TV libraries are clean, and our Compose 1.12 to 1.13 check found no calls in six sample apps either. So the risk is not Google’s code. It is two other places:

  1. Your own modules. These fail loudly now, which is good: the compiler error points at each call.
  2. Third-party libraries compiled against 1.12 or earlier. A carousel, a focus-highlight helper or an older TV row library can still call it. That compiles, links, and does nothing, so the screen just stops following focus.

For the second case, this script lists every .jar and .aar under a folder whose classes mention the symbol, including classes.jar inside an .aar:

#!/usr/bin/env python3
# Find .jar/.aar files whose classes reference a symbol.
import io, sys, zipfile, pathlib

SYMBOL = b"onFocusedBoundsChanged"

def hits(data):
    with zipfile.ZipFile(io.BytesIO(data)) as z:
        for n in z.namelist():
            b = z.read(n)
            if n.endswith(".jar") and hits(b):
                return True  # classes.jar inside an .aar
            if n.endswith(".class") and SYMBOL in b:
                return True
    return False

root = pathlib.Path(sys.argv[1]).expanduser()
for p in root.rglob("*"):
    if p.suffix in (".jar", ".aar"):
        try:
            if hits(p.read_bytes()):
                print(p)
        except zipfile.BadZipFile:
            pass

Run it against your Gradle cache after a build that resolved the app’s dependencies, for example python3 scan.py "$HOME/.gradle/caches/modules-2/files-2.1". We checked it on two small test archives (one .aar whose classes reference the symbol, one clean .jar): it printed only the .aar. Any hit is a library to update, replace, or wrap with one of the patterns above.

The other TV-facing change: clicks now make a sound

Compose 1.13 also changed what a remote’s centre button does. The release post: “Clickable elements configured with Modifier.clickable (or components built on top of it) now automatically play standard Android interaction sound effects, respecting the user’s system sound settings.”

In the source, this went from an experimental flag to always on in commit f900b0b133 of 27 June 2026, which removed ComposeFoundationFlags.isInteractionSoundEffectOnClickEnabled and its “sound dropped when flag disabled” test. So there is no Compose flag to turn it back off. What to check on a TV app:

  • Double sounds. If your D-pad handling already calls View.playSoundEffect() to match Leanback, remove it, or every click plays twice.
  • Custom click handling. Items that handle the centre key through onKeyEvent or onPreviewKeyEvent instead of clickable do not get the sound. Mixed rows will sound uneven.
  • Players. A play or pause control built on clickable now clicks audibly over the video. The sound follows the system setting, so test with touch sounds on.

Checklist for a Compose TV app moving to 1.13

  • Bump to BOM 2026.11.01 (Kotlin 2.2 or newer and compileSdk 37.1, per the release post) and fix every onFocusedBoundsChanged compile error.
  • For each one, decide: scrolling (use onFocusChanged plus BringIntoViewRequester, or nothing if it is a lazy list) or position (use getFocusedRect() on demand).
  • Scan the Gradle cache for libraries that still call it.
  • Remove any manual click sounds that duplicate the new automatic ones.
  • If you are still on Leanback or the old tv-material names, start with our Leanback to Compose for TV guide and the tv-material 1.1.0 renames.

Made by the team behind this post

Apps from our studio

  • Goes with this post

    BMDB.fun

    Your Bollywood world at a glance, with links straight to the OTT app that streams each film.

    Android TV · Web · Mobile

    Get
  • Nix

    The Mac uninstaller that finds what the Trash leaves behind: caches, logs, derived data and saved states.

    macOS

    Get
  • Cardigami

    Pop-up greeting cards that rise out of the fold on iPhone Duo.

    iPhone · App Store

    Get
  • OneClick QuitAll

    Quit every running app in one click. See memory and CPU first.

    macOS · Mac App Store

    Get

Need this built? Let’s talk.

We build and run apps for Mac, TV, mobile and the web, and write about what we learn.