ModalCloseWatcher can be used to listen to a set of signals that might correspond to closing an app-modal dialog. Once a ModalCloseWatcher is created, it will fire an event when a user presses the esc key on desktop, or a system-provided back button on mobile.

Motivation

Modals are UI components that are layered on top of all other content and take interaction focus. An important common feature of these modals is that they are designed to be easy to close, with a uniform interaction mechanism for doing so. Typically, this is the Esc key on desktop platforms, and the back button on some mobile platforms (notably Android). Currently, web developers have no good way to handle these close signals for their own modals. This is especially problematic on Android devices, where the back button is the traditional close signal.

Status in Chromium

Blink


No active development (tracking bug)

Consensus & Standardization

After a feature ships in Chrome, the values listed here are not guaranteed to be up to date.

  • No signal
  • No signal
  • No signal
  • No signals

Owners

Last updated on 2021-01-27