Skip to content

Escape does not close an open dialog #284

Description

@XDLCS

Summary

A open <dialog> (opened via the open attribute or show()) does not close on Escape. The key event reaches the page — a keydown listener observes key: "Escape" — but the dialog's built-in light-dismiss never runs, so dialog.open stays true.

Note: commit 2ddb4f7 ("fix(dialog): enforce show state transitions", 2026-08-29) landed after this was first observed; the Escape path is still not covered by it. This report reflects behavior after that fix.

Environment

  • moli 1.0.6, also verified on local build a1385e0 (includes 2ddb4f7)
  • Chromium baseline: chrome-headless-shell 131.0.6778.204, same CDP script

Reproduction (CDP)

Page:

<dialog id="d" open><p>x</p></dialog>
<script>document.addEventListener("keydown", e => { window.__k = e.key; });</script>

CDP: Input.dispatchKeyEvent keyDown Escape (key/code Escape, windowsVirtualKeyCode 27) then keyUp, wait 500ms.

Observed (moli)

{"open": true, "key": "Escape"}

The event listener fires (key reaches the document), but the dialog remains open. No cancel/close events, no light-dismiss.

Expected (Chromium 131)

Escape on an open dialog → cancel event → dialog closes (open: false), per the dialog light-dismiss spec.

Impact

Keyboard interaction model is incomplete: any page relying on Esc-to-close (modals, settings panels, autocomplete popups) cannot be dismissed via keyboard in moli — a standard agent keyboard-driving scenario.

Verified on a1385e0 (post-2ddb4f7): open:true, key:"Escape" — unchanged.

Activity

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

Metadata

Metadata

Assignees

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