t3code
t3code copied to clipboard
[Bug]: Escape does not exit preview annotation mode until you click inside the page
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/desktop
Steps to reproduce
- Open any web page (not a PDF) in the desktop preview browser.
- Click Annotate preview in the browser toolbar.
- Without clicking anything else, press Escape.
Expected behavior
Escape exits annotation mode right away, the same as it does after you have clicked once inside the page.
Actual behavior
Nothing happens. Annotation mode stays on until I click somewhere in the page. After that click, Escape exits as expected.
Cause in source (main @ ade473018d):
- The only Escape handler for annotation mode is the guest page's
windowkeydown listener (apps/desktop/src/preview/PickPreload.ts:1742, handled at:1637). The host app has no Escape handling while a pick is active. - When annotation starts,
Manager.ts:2268callswc.focus()on the guest webContents, but nothing in the page takes focus. Right after the toolbar click, keys still go to the app chrome, so Escape never reaches the listener. - PDFs already work around this:
PickPreload.ts:856-865adds a focusableinputLayer"for Escape and the tool keys". Regular pages get no equivalent, so the V/R/D/E tool keys have the same first-click problem.
Possible fix: focus an overlay element on regular pages the way the PDF path does, or have the host handle Escape while a pick is active and send the existing CANCEL_PICK_CHANNEL.
Impact
Minor bug or occasional failure
Version or commit
Desktop 0.1.7; source unchanged on main @ ade473018d
Environment
Linux (Ubuntu, GNOME), T3 Code desktop AppImage
Workaround
Click once inside the page, then press Escape.