Skip to content

Fix search focus trap and improve D-Pad navigation#5319

Open
sandro-byte32 wants to merge 2 commits intojellyfin:masterfrom
sandro-byte32:master
Open

Fix search focus trap and improve D-Pad navigation#5319
sandro-byte32 wants to merge 2 commits intojellyfin:masterfrom
sandro-byte32:master

Conversation

@sandro-byte32
Copy link

  • Migrate SearchTextInput to AppCompatEditText for better D-Pad support
  • Fix focus trap when dismissing keyboard via Back button
  • Enable IME re-triggering on D-Pad Center click
  • Improve visual highlighting for D-Pad navigation
  • Prevent focus navigation into empty search results

Changes:
Overhauled the search screen navigation by migrating SearchTextInput from a standard Compose field to a wrapped AppCompatEditText. This fix resolves a focus trap occurring when the keyboard is dismissed via the Back button and ensures the IME can be re-triggered using the D-Pad Center button. Additionally, visual highlighting for D-Pad navigation was improved, and navigation into empty search result fragments is now prevented.

Code assistance:
Code was generated and refined using LLMs (Claude and Codex) to orchestrate complex focus transitions between Jetpack Compose components and the Leanback-based RowsSupportFragment. The AI assisted in implementing a robust AndroidView wrapper to handle low-level key events that are currently limited in standard Compose text fi

Fixes #5300
Refs #5160
Related to #5162

sandro-byte32 and others added 2 commits January 6, 2026 17:32
- Migrate SearchTextInput to AppCompatEditText for better D-Pad support
- Fix focus trap when dismissing keyboard via Back button
- Enable IME re-triggering on D-Pad Center click
- Improve visual highlighting for D-Pad navigation
- Prevent focus navigation into empty search results
@sandro-byte32
Copy link
Author

To provide some context on the architectural changes in this PR:

I decided to migrate SearchTextInput from the standard Compose BasicTextField to a wrapped AppCompatEditText (via AndroidView).

The reason for this is that the current Compose implementation lacks the necessary low-level D-Pad and IME intercept capabilities, specifically the ability to override onKeyPreIme. This was the only reliable way to catch the Back button event while the keyboard is open and programmatically resolve the focus trap across various Android TV vendors (e.g., Sony, FireTV, Shield).

This change allows for much more robust focus orchestration between the search input and the Leanback results grid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Search focus remains stuck in text field after pressing Back button

1 participant