The Close Watcher API provides a platform agnostic way to respond to close requests, this is useful for any UI that closes (e.g. navigation drawers). On desktop this was traditionally solved through an Escape key press, but Close Watcher expands this to include accessibility tools and Android's back gesture/button. For developers using HTML <dialog> or [popover] they get these benefits for free as the close watcher API is integrated with them. This proposal covers both the core API and it's integration with <dialog> and [popover].
Because it's implemented in Chromium and not in Firefox, on Android the browsers have behaviour differences for popover and dialog. In chromium and open popover/modal dialog will close on back gesture, in Firefox the page will navigate backwards.
Description
The Close Watcher API provides a platform agnostic way to respond to close requests, this is useful for any UI that closes (e.g. navigation drawers). On desktop this was traditionally solved through an Escape key press, but Close Watcher expands this to include accessibility tools and Android's back gesture/button. For developers using HTML
<dialog>
or[popover]
they get these benefits for free as the close watcher API is integrated with them. This proposal covers both the core API and it's integration with<dialog>
and[popover]
.Specification
https://html.spec.whatwg.org/multipage/interaction.html#close-requests-and-close-watchers
Additional Signals
Standards Positions
https://github.com/WebKit/standards-positions/issues/215 - Neutral https://github.com/mozilla/standards-positions/issues/604 - Positive
Current State of the Feature
Currently shipping in Chromium only.
Because it's implemented in Chromium and not in Firefox, on Android the browsers have behaviour differences for popover and dialog. In chromium and open popover/modal dialog will close on back gesture, in Firefox the page will navigate backwards.
Browser Bugs
https://bugzilla.mozilla.org/show_bug.cgi?id=1859702 https://bugs.webkit.org/show_bug.cgi?id=263305