Skip to content

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

Closed

Description

@niclom12

Before submitting

  • I searched existing issues and did not find a duplicate.
  • 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 @ ade4730):

  • 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 @ ade4730

Environment

Linux (Ubuntu, GNOME), T3 Code desktop AppImage

Workaround

Click once inside the page, then press Escape.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions