t3code icon indicating copy to clipboard operation
t3code copied to clipboard

[Bug]: Escape does not exit preview annotation mode until you click inside the page

Open niclom12 opened this issue 3 weeks ago • 0 comments

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

  1. Open any web page (not a PDF) in the desktop preview browser.
  2. Click Annotate preview in the browser toolbar.
  3. 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 window keydown 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:2268 calls wc.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-865 adds a focusable inputLayer "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.

niclom12 avatar Nov 08 '26 14:11 niclom12