Files
Codeman/test
Codeman maintainer 79f85415d8 fix(web): a dialog opened with the mouse hands the keyboard back to the terminal
After App Settings or Session Options was opened with a mouse click and
closed, nothing typed reached the terminal until it was clicked again.
FocusTrap saved document.activeElement when the dialog opened, and by then
the press had already moved focus: onto the pressed control in Chromium and
Firefox, onto <body> in WebKit on macOS, where a button takes no focus from
the mouse.

FocusTrap.focusToReturn() is what a dialog saves now. A pointerdown listener
records the typing field that had focus when a mouse press began (pointerdown
comes before mousedown, whose default action moves focus), and that field is
the answer when focus sits on the pressed control or on <body> as the dialog
opens. Any key forgets the press, so a control reached with the keyboard gets
focus back as before. Only a typing field is remembered, for one press (a
press on a menu item inherits it from the press that opened the menu) and
only for a mouse, so touch is unchanged. Asking spends the press, so nothing
pressed inside the opening dialog can hand the keyboard to a field behind it.

The command palette and the Session Manager save the same answer.

Measured in Chromium against a running server: App Settings and Session
Options opened by mouse ended on the clicked gear before and in the terminal
after, also with the press clearing focus as WebKit on macOS does, with the
tile grid and the split open (the keyboard returns to the pane it was in),
and through a tile's menu. Not run in WebKit on macOS itself.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-25 10:23:52 +01:00
..
2026-06-19 17:58:06 -04:00
2026-06-19 17:58:06 -04:00
2026-08-22 14:13:57 +02:00
2026-07-20 02:36:02 +02:00
2026-06-19 13:10:17 -04:00