Intent to Prototype: ModalCloseWatcher

143 views
Skip to first unread message

Nate Chapin

unread,
Jan 26, 2021, 1:36:23 PMJan 26
to blink-dev, Domenic Denicola

Contact emails

jap...@chromium.org, dom...@chromium.org


Explainer

https://github.com/slightlyoff/history_api/blob/master/history_and_modals.md


Specification

None yet


Summary

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.


This proposal has potential overlap with the <popup> proposal (I2P), as the explainer notes. We believe prototyping ModalCloseWatcher is valuable, but when it comes time to potentially ship, we'll need to evaluate whether ModalCloseWatcher is worth exposing independently from <popup>.


Blink component

Blink


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.


Initial public proposal

https://github.com/slightlyoff/history_api/blob/master/history_and_modals.md


TAG review

https://github.com/w3ctag/design-reviews/issues/594


TAG review status

Pending


Risks


Interoperability and Compatibility

This API is designed to have an interoperable surface for web developers, to help them avoid platform-specific code. So, if it were implemented across browsers, it would be a positive for interoperability. We have not yet asked for signals, however.


From a compatibility perspective, this feature has a relatively simple API surface that allows us to swap out the underlying behavior, which reduces the likelihood of needing breaking changes in the future.


Gecko: No signal


Edge: No signal


WebKit: No signal


Web developers: Positive signals. We have talked to a couple control libraries who are interested in solving this problem and will test our prototype to see if it is a good solution.



Is this feature fully tested by web-platform-tests?

No


Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/4722261258928128


Reply all
Reply to author
Forward
0 new messages