Skip to content

fix: dismiss keyboard properly in Settings search on TV - #3217

Open
kiinshuk wants to merge 1 commit into
recloudstream:masterfrom
kiinshuk:fix/settings-keyboard-dismiss
Open

kiinshuk wants to merge 1 commit into
recloudstream:masterfrom
kiinshuk:fix/settings-keyboard-dismiss

Conversation

@kiinshuk

Copy link
Copy Markdown

Summary

This PR fixes the keyboard not dismissing properly in the Settings screen on TV devices (Fire TV, Android TV).

Issues Fixed

Changes Made

In SettingsFragmentScreen.kt:

  1. Hide keyboard when search field loses focus - Added keyboardController?.hide() in the onFocusChanged callback when focus is lost
  2. Hide keyboard when back/clear button is pressed - Added keyboardController?.hide() in the leading icon's onClick handler
  3. Hide keyboard when clear text (X) button is pressed - Added keyboardController?.hide() and ocusManager.clearFocus() in the trailing icon's onClick handler
  4. Hide keyboard when navigating to a settings sub-screen - Added keyboardController?.hide() in SettingsTab's onPreferenceClick before navigation
  5. Hide keyboard when clicking a search result - Added keyboardController?.hide() in SettingSearchResults's onItemClick callback

Testing

  • Tested on Android TV emulator: keyboard now properly dismisses when navigating between settings screens
  • Tested on Fire TV: back button and clear button now properly dismiss the keyboard
  • Search results navigation no longer leaves the keyboard open

- Hide keyboard when search field loses focus
- Hide keyboard when back/clear button is pressed
- Hide keyboard when clear text (X) button is pressed
- Hide keyboard when navigating to a settings sub-screen
- Hide keyboard when clicking a search result

Fixes recloudstream#3171 and recloudstream#3177
@LagradOst

Copy link
Copy Markdown
Contributor

Can you can confirm that this issue still exists on the latest pre-release, and that this pull request changes anything. Because I suspect this issue was already solved by a recent fix, but the issues where not closed.

@kiinshuk

Copy link
Copy Markdown
Author

Thanks for checking! I tested against the latest pre-release (after #3201 was merged), and the keyboard issues still exist. PR #3201 replaced the SearchBarDefaults.InputField with a plain TextField, but the keyboard dismissal was not fully addressed:

  1. Back arrow button (line 340-342 on master): calls ocusManager.clearFocus() but does NOT call keyboardController?.hide() -- on Fire TV the software keyboard persists after clearing focus
  2. Close (X) trailing icon (line 361-364 on master): only clears the text, does not clear focus or hide the keyboard at all
  3. Sub-screen navigation (SettingsTab.onPreferenceClick): no keyboard hiding before navigating to General/Player settings -- on TV the keyboard follows you into those screens
  4. onFocusChanged: when focus is lost programmatically, the keyboard is not explicitly hidden
  5. Search result clicks: no keyboard dismissal before navigating

The DisposableEffect on line 374-378 only hides the keyboard when the composable is disposed (i.e. leaving the Settings screen entirely), not during any of the above interactions.

This PR adds keyboardController?.hide() calls in all the places where the keyboard should be dismissed. Happy to rebase if needed.

This branch has not been deployed

No deployments
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.

2 participants