You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android: Back while a dialog is open sends the app to the background instead of closing the dialog #108
On an Android TV 16 emulator (API 36, system-images;android-36;android-tv;x86_64), Back while a mobile dialog is open sends the app to the background instead of closing the dialog. Seen with Add camera opened from the Welcome sheet and from the toolbar Add button, on main plus #99 (before #106), with adb shell input keyevent BACK. Back from a camera page does go back to the list, so MainView.OnBackRequested → MainWindowViewModel.TryGoBack is reached there; with a dialog open, OverlayDialogPresenter.TryDismissTopmost should take it first, but the app goes to the background.
Not yet checked: a phone on API 36 and older Android versions, a physical remote.
Expected: Back closes the topmost dialog (as TryGoBack documents), and only at the root sends the app to the background.
Root cause, reproduced on main (b5e1193) on the Android TV 16 emulator: Back does not skip the dialog, it closes it and then acts a second time.
Avalonia on Android maps Keycode.Back to Key.Escape (AndroidKeyboardDevice.cs:211), so the key event reaches Button.RootCancelKeyDown, and IsCancel on the Cancel button in CameraEditorContent closes the form. 16–50 ms later the same press arrives through OnBackInvoked: no dialog is open any more, TryGoBack returns false at the root, and the app goes to the background.
It reproduced only on Add camera, the one form with IsCancel: by tap, D-pad and from Welcome. Discovery, Camera groups and Welcome close correctly and the app stays in front.
Activity
compot-dev commentedon Nov 5, 2026
Root cause, reproduced on
main(b5e1193) on the Android TV 16 emulator: Back does not skip the dialog, it closes it and then acts a second time.Avalonia on Android maps
Keycode.BacktoKey.Escape(AndroidKeyboardDevice.cs:211), so the key event reachesButton.RootCancelKeyDown, andIsCancelon the Cancel button inCameraEditorContentcloses the form. 16–50 ms later the same press arrives throughOnBackInvoked: no dialog is open any more,TryGoBackreturns false at the root, and the app goes to the background.It reproduced only on Add camera, the one form with
IsCancel: by tap, D-pad and from Welcome. Discovery, Camera groups and Welcome close correctly and the app stays in front.