Skip to content

Commit

Permalink
Add close signals and close watchers
Browse files Browse the repository at this point in the history
This adds the generic close signal concept, which allows interfaces like the Esc key, or back gestures and buttons, to be interpreted as closing various "close watchers". Two existing constructs are converted to close watchers: modal dialog elements, and auto popovers. Additionally, this adds the CloseWatcher API, which lets web developers create their own close watchers. Additionally, the close signal steps formalize previously-informal parts of the Fullscreen API Standard.

The specification text here is largely ported from https://github.com/WICG/close-watcher/blob/3a18e6811528d349df27a3e7b06b8dc018638c4c/spec.bs, with the only substantial update being requiring keyup to be the close signal event for user agents which use the Esc key as a close signal. (This is per discussions in #9143.)

This change to dialog behavior is a potential compatibility risk, especially since it can cause the cancel event to be skipped if there has been no user activation since the last time it was canceled, or multiple dialogs to be closed at once. However, Chromium data shows these risks to be negligible:

* https://chromestatus.com/metrics/feature/timeline/popularity/4422 shows 0.000081% of pages impacted by skipped cancel events
* https://chromestatus.com/metrics/feature/timeline/popularity/4423 shows 0.000006% of pages impacted by skipped cancel events that would otherwise call preventDefault()
* https://chromestatus.com/metrics/feature/timeline/popularity/4424 shows between 0.000000% and 0.000001% of pages impacted by multiple dialogs closed

Closes #9143.
  • Loading branch information
domenic committed Aug 10, 2023
1 parent 0593c91 commit 8036fca
Showing 1 changed file with 701 additions and 43 deletions.
Loading

0 comments on commit 8036fca

Please sign in to comment.