CloseWatcher can be used to listen to a set of signals that might correspond to closing an in-app dialog, picker, or overlay. On desktop this is typically the Esc key; on mobile it can be a system-provided back button.

Motivation

An important common feature of various "modal" or "popup" components in web apps 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 components. This is especially problematic on Android devices, where the back button is the traditional close signal.

Demo

Specification

Specification link


Specification being incubated in a Community Group

Status in Chromium

Blink


In developer trial (Behind a flag) (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
  • Positive

Owners

Intent to Prototype url

Intent to Prototype thread

Last updated on 2021-11-28