Conversation
|
you know i havent had a chance to recheck this but I wonder this is still necessary? at the time it was used to help android tv users login because they couldnt even switch to the password field using the remote control. This was before the frontend login screen was updated to be more modern. I do recall we have a bug from a keyboard only user getting stuck due to this one too. |
There was a problem hiding this comment.
Pull request overview
This PR moves the Android TV DPAD_DOWN → TAB navigation workaround from the legacy WebViewActivity key dispatch override into the shared HAWebView composable, so the behavior is applied at the WebView level whenever HAWebView is used.
Changes:
- Removed
dispatchKeyEventoverride (andKeyEventimport) fromWebViewActivity - Added a
WebView.remapDpadDownToTab()helper using anOnKeyListener - Applied the remapping automatically in
HAWebView’sAndroidView.factoryblock and documented the behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| app/src/main/kotlin/io/homeassistant/companion/android/webview/WebViewActivity.kt | Removes the Activity-level DPAD_DOWN workaround, relying on WebView-level handling instead |
| app/src/main/kotlin/io/homeassistant/companion/android/util/compose/webview/HAWebView.kt | Adds and applies DPAD_DOWN → TAB remapping via OnKeyListener, with updated KDoc |
| private fun WebView.remapDpadDownToTab() { | ||
| setOnKeyListener { view, keyCode, event -> | ||
| if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN && event.action == KeyEvent.ACTION_DOWN) { | ||
| view.dispatchKeyEvent(KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_TAB)) | ||
| true | ||
| } else { | ||
| false | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
This introduces new key-handling behavior (DPAD_DOWN -> TAB) but there is no automated test covering it. Please add a unit/Robolectric or Compose UI test that verifies a DPAD_DOWN key event dispatched to the WebView results in a TAB key event being forwarded, to prevent regressions across Android TV and non-TV devices.
Thanks for jumping in I remember discussing about it but I didn't remember what was the outcome .... So maybe it is not relevant anymore. |
Summary
DPAD_DOWN to TAB remapping for Android TV
Checklist