From 8036fcaab57841f5edb41f6bf3701a67f551a80d Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 28 Jun 2023 15:07:20 +0900 Subject: [PATCH] Add close signals and close watchers 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. --- source | 744 +++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 701 insertions(+), 43 deletions(-) diff --git a/source b/source index 657afbe5d4d..609315f1646 100644 --- a/source +++ b/source @@ -3267,6 +3267,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • AbortSignal
  • aborted
  • signal abort
  • +
  • add
  • The get an attribute by name algorithm
  • @@ -3355,13 +3356,14 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

    User agents are encouraged to implement the features described in execCommand. EXECCOMMAND

    -

    The following parts of Fullscreen API are referenced from this - specification, in part to define the rendering of dialog elements, and also to - define how the Fullscreen API interacts with HTML: FULLSCREEN

    +

    The following features are defined in Fullscreen API: FULLSCREEN

    @@ -60380,9 +60382,8 @@ interface HTMLDialogElement : HTMLElement {