Repository navigation
Android: keep the D-pad focus inside mobile dialogs - #106
Conversation
Mobile dialogs (OverlayDialogPresenter) sit in the TopLevel's OverlayLayer over the page, but nothing kept the keyboard focus in them. A TV remote's XY focus navigation searches the whole TopLevel, so the arrows walked off the sheet onto the page under the dim: on first start, Down from the Welcome sheet landed in the Library search box and opened the keyboard. - Arrows that reach a dialog's dim unhandled are searched within its card only (FindNextElement with SearchRoot) and focused as Directional, so the focus ring shows; at the card's edge the focus stays put. Tab cycles inside the dialog. Controls that use arrows themselves (a TextBox caret) handle them first, as before. - A dialog opened from a key starts with its first control focused; one opened by a tap only takes the focus off the page (the card holds it, no ring, no keyboard), and the first arrow then goes to its first control. - If the focused control goes away while a dialog is open (the discovery sheet's "Scan again" button is replaced by the scan), the next navigation key starts again from the topmost dialog's first control instead of the page behind it. - When a dialog closed from a key, the focus goes back to where it was (posted, as the button that opened it stays disabled until its command, which awaits the dialog, ends). Desktop dialogs are real windows and do not go through this path. Checked on an Android TV 16 emulator with D-pad input only: Welcome, Add camera and the discovery sheet opened on top of it keep the focus, the focus returns to the toolbar Add button after closing, and "Scan again" no longer lets the arrows reach the page. Desktop build /warnaserror and tests as in CI: 0 warnings, all pass. Fixes #102
PR Summary by QodoKeep Android D-pad focus inside mobile dialogs
AI Description
Diagram
High-Level Assessment
Files changed (1)
|
Code Review by Qodo
1. Dialog arrows seek the video underneath
|
Arrows in a mobile dialog now move the focus only within its card (Directional, so the focus ring shows), and Tab cycles inside it. A dialog opened from a key starts on its first control; one opened by a tap only takes the focus off the page, so the soft keyboard does not pop up on its own. If the focused control disappears (the discovery sheet's "Scan again"), the next key starts again from the dialog, not from the page behind it. Closing a dialog from a key gives the focus back to where it was. Desktop dialogs are real windows and are not affected.
Checked on an Android TV 16 emulator with D-pad input only: Welcome, Add camera and the discovery sheet on top of it; desktop build and tests as in CI pass.
Fixes #102