Dev Tools · 1h ago
Android TV D-Pad Bug: onPreviewKeyEvent vs onKeyEvent in Compose
A bug in Jetpack Compose for Android TV caused long-press on the d-pad center button to fail inconsistently. The fix involved switching from onKeyEvent to onPreviewKeyEvent to handle the event during the capture phase instead of the bubble phase. This prevents the click handler from consuming the ACTION_DOWN event before the long-press logic runs.
Meridian48 take
A niche but instructive bug for Android TV developers, highlighting how event propagation phases can cause subtle input handling issues.
Read the full reporting
onPreviewKeyEvent vs onKeyEvent on Android TV: A Subtle D-Pad Bug →
DEV Community
android-tvjetpack-compose