v136 · dom

'request-close' Invoker Command

Dialog elements can be closed through a variety of mechanisms, sometimes developers want to have the ability to prevent closure. To achieve this dialogs fire a cancel event. Originally this was only fired via a close request (e.g. ESC key press), recently a `requestClose()` JS function was added which also fires the cancel event. The 'request-close' comma

concepts

  1. Dialog Cancel

    request-close invoker command fires the dialog's cancel event before closing — declarative replacement for dialog.close() + cancel-event-dispatch.

  2. Unsaved-changes confirmation

    Real editor dialog: backdrop, Esc, and Cancel all funnel through one cancel gate that pops a nested "discard?" sub-dialog when the form is dirty.

  3. Cancel Event Tracer

    Every close path on a single dialog: ESC, backdrop, close(), requestClose(), and both command="close" / command="request-close" invokers. The log shows whether cancel fires before close, and whether preventDefault() stops it.

  4. Multi-Dialog Stack

    A 3-step wizard where every Cancel, back button, and Esc routes through command="request-close". One cancel handler per step implements back-navigation without duplicating logic — and the event log shows exactly which event fired on each close path.

why it shipped

Invoker commands exposes existing dialog and popover functions to declarative HTML, for consistency we should also expose the new requestClose().

references