Add support for Android TV#146
Merged
Merged
Conversation
cebc54b to
4b37512
Compare
This required a bit of hackery in webview_bridge.js to make Syncthing's web UI navigable via arrow keys. There are a few main issues: * Many web UI elements don't have a visually distinct focused state, so we inject some CSS to add a dotted border around the focused element. * The dropdown menus have a keydown handler coming from Bootstrap that hijacks the up/down arrow keys, making it difficult or impossible to leave the dropdown menus using the browser's builtin spatial navigation. * The <input type="number"> elements have default browser behavior of incrementing or decrementing the number using the arrow keys. There are no spatial navigation APIs available yet, so we can't just preventDefault() these events. Instead, we have a horrible hack to make the field immutable for 100ms while the default handler runs. There are also some limitations in functionality due to Android TV: * Importing, exporting, and saving logs will never work because DocumentsUI doesn't exist. * The persistent notification isn't visible because notifications for third party apps isn't supported at all. However, the permission must still be requested for the foreground service to run reliably. * "Battery" optimizations also need to be disabled for the foreground service to run reliably, but there's no UI for it. Users need to grant the permission via adb. On the BasicSync side, there were a couple things to fix: * Snackbars are not focusable. Compose doesn't provide an easy way to fix this, so we just skip the snackbar button and show the error details dialog immediately. * The split switch preference's switch element isn't focusable with arrow keys by default (but is focusable with the tab key). This was fixed by manually specifying start/end focus direction targets. Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
chenxiaolong
added a commit
that referenced
this pull request
Jun 4, 2026
Signed-off-by: Andrew Gunnerson <accounts+github@chiller3.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This required a bit of hackery in
webview_bridge.jsto make Syncthing's web UI navigable via arrow keys. There are a few main issues:keydownhandler coming from Bootstrap that hijacks the up/down arrow keys, making it difficult or impossible to leave the dropdown menus using the browser's builtin spatial navigation.<input type="number">elements have default browser behavior of incrementing or decrementing the number using the arrow keys. There are no spatial navigation APIs available yet, so we can't justpreventDefault()these events. Instead, we have a horrible hack to make the field immutable for 100ms while the default handler runs.There are also some limitations in functionality due to Android TV:
DocumentsUIdoesn't exist.On the BasicSync side, there were a couple things to fix: