Skip to content

Commit

Permalink
Add close requests and close watchers
Browse files Browse the repository at this point in the history
This adds the generic close request 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. Note that the close request 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. Updates include:

* Requiring requiring keyup to be the close request event for user agents which use the Esc key as a close request, per discussions in #9143.
* Introducing requestClose(), per WICG/close-watcher#28.
* Renaming the "close signal" concept to "close request".

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.000015% of pages impacted by skipped cancel events
* https://chromestatus.com/metrics/feature/timeline/popularity/4423 shows 0.000007% 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 ec14e3d
Showing 1 changed file with 701 additions and 43 deletions.
Loading

0 comments on commit ec14e3d

Please sign in to comment.