← Back to release summary

'request-close' Invoker Command

Category
DOM
Type
New or changed feature
Status
In developer trial (Behind a flag) (Chrome 139)
Intent stage
None

Summary

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' command brings that new ability to the declarative invoker commands API.

Motivation

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

Standards & signals

Explainers: https://github.com/whatwg/html/pull/11045

View on chromestatus.com