Bubble

Return from a key handler to pass the key on instead of consuming it

import { bubble } from "@roku-sdk/navigation";
const bubble: unique symbol

Description

Return from a key handler to pass the key on instead of consuming it.

A bubbled key keeps going down the dispatch chain: after a focused leaf's onKey it gets directional navigation (key-down only), then the boundary's onUnhandledKey, then the parent boundary.

It is a registered symbol (Symbol.for) so that every copy of this package agrees on it. An app can end up with two copies (a version skew between a library's peer and the app's own install), and a plain Symbol() from one copy would not be === to the other's, so a decline returned by a library would silently consume instead.

Example

onUnhandledKey: { down: onPress(() => grid.tryMoveDown() || bubble) }

What’s Next

Did this page help you?