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
Kräfte: the STATUS combo in a grid row loses keyboard focus when its popup closes, so Down moves the grid cursor #536
In the Kräfte grid, the STATUS ComboBox in a row gives up keyboard focus as soon as its popup closes. After you choose a status, pressing Down moves the DataGrid's cell cursor to the next row instead of changing the status. A Lagebuchführer working from the keyboard has to click back into the combo for every change.
This is the half of #294 that its three PRs (#531, #532, #533) did not fix. It also turns out not to be caused by the rebuild. #294 blamed the Clear() + re-add on session.Changed, but the focus loss happens with no save and no Changed at all.
Confirmed in the real app
main at 74b2837, the desktop build on a private Xvfb display with real X11 popups (not headless), the fictional docs/samples/uebung.fwincident and the demo Stammdaten.
Down then moves the cell cursor to row 3. The status of row 2 does not change.
2. Control without any save: open, Escape, Down (row 1).
Open row 1's STATUS combo and close it with Escape. Nothing changes, nothing is saved, and Changed does not fire.
Down still moves the cell cursor from row 1 to row 2.
So the focus loss comes from the ComboBox living inside the DataGrid, not from rows being rebuilt.
Why #294's control test did not catch this: it used the add form's STATUS combo, which keeps focus, and concluded that the rebuild was to blame. But that combo differs from the grid's in two ways at once. It is never rebuilt, and it is not inside a DataGrid. Now that the grid is no longer rebuilt (#531), the in-grid combo still loses focus, so the DataGrid is the remaining difference.
Note for a repro: use a middle row. On the last row a grid-cursor Down has nowhere to go and looks like "nothing happened".
Where to look (unverified)
The likely cause is that the DataGrid takes focus back for its current cell when the combo's popup closes. Alternatively, DataGrid may handle KeyDown for Down before the ComboBox sees it. Either would match what we see.
Check how Avalonia 12's DataGrid treats focusable controls in a DataGridTemplateColumn cell template, using the avalonia-docs MCP. Things to check:
the cell's Focusable and IsTabStop;
whether the column should be in edit mode (CellEditingTemplate);
whether the grid's IsReadOnly="True" (ForcesView.axaml) changes focus handling.
An [AvaloniaFact] on the real ForcesView that opens and closes a row's STATUS combo, then sends Down. It should assert that the status changed, not that the grid's current row moved. Headless focus has been unreliable here, so treat the test as the backstop.
The real check is the manual probe: pick a status on a middle row, press Down, and the status should step to the next option.
Activity
fix(kraefte): keep keyboard focus on a clicked STATUS combo in the gr…