Skip to content

fix(iptv): keep remote focus inside the playlist dialog after typing - #764

Merged
ProdigyV21 merged 4 commits into
ProdigyV21:mainfrom
ReichiMD:claude/loving-turing-nf9ntr
Sep 27, 2026
Merged

ProdigyV21 merged 4 commits into
ProdigyV21:mainfrom
ReichiMD:claude/loving-turing-nf9ntr

Conversation

@ReichiMD

Copy link
Copy Markdown
Contributor

Problem

Reported on Discord ("IPTV Unusable on Android TV") and r/ARVIO: on a Fire TV Stick the Add Playlist dialog closes on its own after typing M3U/Xtream details, so no playlist can be added. A second user: "after entering the details, the active button disappears". It works on an emulator with a mouse and on Google TV / Shield.

Cause

In IptvPlaylistModal, the D-pad exits of a text field call clearFocus() and then modalFocusRequester.requestFocus(). The keyboard's Done action and the Back key only call clearFocus(). Focus then goes to whatever Compose finds first. The full-screen scrim is clickable, so on a remote it is a focus target, and OK on it runs onDismiss. The highlight disappears (the dialog draws it from its own row state), and the next OK throws away everything typed. The full-screen Amazon keyboard on Fire TV is usually left with Done or Back, so Fire TV users hit this every time.
Also, hideKeyboardAll() called view.requestFocus() on a LocalView read outside Dialog {}, i.e. the activity's view behind the dialog.

Change (1 file, +48/-12)

  • Done and Back in a field call a new onKeyboardClosed callback that returns focus to the dialog, the same way the D-pad exits already do (all eleven TV-layout fields; the touch layout passes nothing).
  • hideKeyboardAll() focuses the dialog on TV instead of the activity view.
  • The scrim and dismissOnClickOutside only dismiss on devices with a touchscreen (LocalHasTouchScreen). Phones and tablets keep tap-outside-to-close.

Testing

  • Fire TV Stick 4K Max: 2.0.0 reproduces the bug. With this change the playlist can be added and the dialog stays usable with the remote, after leaving the keyboard with Done and with Back.
  • Google TV (TCL C7K): unchanged (it never reproduced there).
  • testSideloadDebugUnitTest: 1828 tests, 0 failures.
  • Not covered by an automated test: the keyboard path goes through a native EditText inside an AndroidView, which the Compose test APIs cannot drive (pressImeActionButton only works on Compose text fields).

Not in this PR

  • ModalScrim in SettingsScreen.kt (e.g. quality filter editor, cloud e-mail/password) and AppUpdateModal.kt use the same clickable scrim, so the same focus trap may exist there on TV. Left out to keep this PR small.
  • Cancel/Save and the tabs are still focusable on TV. With focus now returned right away there is no known path to them, so they were left as they are.
  • With a mouse on a TV without a touchscreen, clicking beside the dialog no longer closes it (Back and Cancel still do).

created by Claude (Anthropic) on behalf of @ReichiMD

On a remote, closing the on-screen keyboard with Done or Back cleared the
text field's focus without putting it anywhere. The highlight vanished and
the next OK landed on the full-screen scrim (or a button drawn as
unfocused), which dismissed the dialog with everything typed. Reported on
Fire TV, where the full-screen Amazon keyboard is usually left this way;
the D-pad exits from a field already brought the focus back.

- Done and Back in a field return the focus to the dialog, the same way
  the D-pad exits do.
- hideKeyboardAll() focuses the dialog on TV instead of the activity view
  behind it.
- The scrim (and outside clicks) only dismiss on devices with a
  touchscreen; without one it is no longer a focus target.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017zSZCHkFmK8fgB2UhxpmX4
@github-actions github-actions Bot added the area: android Changes to the Android app or Gradle build label Sep 27, 2026
@ProdigyV21

Copy link
Copy Markdown
Owner

Thanks for fixing this remote-focus path. I added a guard for late native keyboard callbacks and an on-device regression test. All 9 IPTV dialog tests passed on a TV emulator, including typing into the guide field, pressing Done, then navigating to Save with the D-pad. Play and Sideload Kotlin compilation also passed. Merging with your original commits preserved.

@ProdigyV21
ProdigyV21 merged commit e78c79a into ProdigyV21:main Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: android Changes to the Android app or Gradle build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants