From 80a8760f4580186fcc4212f415873e08ff126289 Mon Sep 17 00:00:00 2001 From: Mustaq Ahmed Date: Fri, 2 Sep 2022 16:52:40 -0400 Subject: [PATCH 1/6] Add a `navigator` interface for user activation state. Fixes: https://github.com/whatwg/html/issues/4008 --- source | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 67 insertions(+), 1 deletion(-) diff --git a/source b/source index fd6502657a2..ae083125380 100644 --- a/source +++ b/source @@ -75753,7 +75753,7 @@ END:VCARD seconds, so that the user can possibly perceive the link between an interaction with the page and the page calling the activation-gated API.

-

These two values imply two boolean user activation states for W:

+

These two values imply two boolean user activation states for W:

Sticky activation
@@ -75904,6 +75904,72 @@ END:VCARD
+

The UserActivation interface

+ +

The user activation states are exposed via the UserActivation + interface. UserActivation objects can be created either as a live or snapshot object, + it depends on how the object was referenced. Objects accessed via navigator's userActivation attribute are live, in that changes + will in the user activation states will be reflected in the attributes of the + object.

+ +
[Exposed=(Window,Worker,AudioWorklet)]
+interface UserActivation {
+  readonly attribute boolean hasBeenActive;
+  readonly attribute boolean isActive;
+};
+
+partial interface Navigator {
+  [SameObject] readyonly attribute UserActivation userActivation;
+};
+ +
+ +
navigator . userActivation
+ +
+ +

Returns the a live object representing the current user activation states.

+ +
+ +
userActivation . hasBeenActive
+ +
+ +

Returns the state of the sticky activation.

+ +
+ +
userActivation . isActive
+ +
+ +

Returns the state of the transient activation.

+ +
+ +
+ +
+ +

The hasBeenActive attribute + must return the state of the sticky activation. If the object is live it must + always reflect the current state. If the object is a snapshot it must reflect the state at which + the time the object was created.

+ +

The isActive attribute must return + the state of the transient activation. If the object is live it must always + reflect the current state. If the object is a snapshot it must reflect the state at which the time + the object was created.

+ +

The userActivation attribute must + return a live representation of the user activation states.

+ +

Activation behavior of elements

From 9d31a638c880028e11a5fca89c48f56388bf60c9 Mon Sep 17 00:00:00 2001 From: Mustaq Ahmed Date: Fri, 2 Sep 2022 17:10:03 -0400 Subject: [PATCH 2/6] Remove "snapshot" --- source | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/source b/source index ae083125380..a2c35d7ab71 100644 --- a/source +++ b/source @@ -75907,10 +75907,9 @@ END:VCARD

The UserActivation interface

The user activation states are exposed via the UserActivation - interface. UserActivation objects can be created either as a live or snapshot object, - it depends on how the object was referenced. Objects accessed via navigator's userActivation attribute are live, in that changes - will in the user activation states will be reflected in the attributes of the + interface. The UserActivation object accessed via navigator's userActivation attribute is live, in that changes + in the user activation states will be reflected in the attributes of the object.

[Exposed=(Window,Worker,AudioWorklet)]
@@ -75957,14 +75956,10 @@ partial interface Navigator {
   

The hasBeenActive attribute - must return the state of the sticky activation. If the object is live it must - always reflect the current state. If the object is a snapshot it must reflect the state at which - the time the object was created.

+ must return the state of the sticky activation.

The isActive attribute must return - the state of the transient activation. If the object is live it must always - reflect the current state. If the object is a snapshot it must reflect the state at which the time - the object was created.

+ the state of the transient activation.

The userActivation attribute must return a live representation of the user activation states.

From 1502c104007a5ca814c74ab53d1dde4e2752fd24 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 5 Sep 2022 13:37:52 +0900 Subject: [PATCH 3/6] Easy editorial fixes --- source | 35 ++++++++--------------------------- 1 file changed, 8 insertions(+), 27 deletions(-) diff --git a/source b/source index a2c35d7ab71..eeb7291ca9e 100644 --- a/source +++ b/source @@ -75907,50 +75907,31 @@ END:VCARD

The UserActivation interface

The user activation states are exposed via the UserActivation - interface. The UserActivation object accessed via navigator's userActivation attribute is live, in that changes - in the user activation states will be reflected in the attributes of the + interface. The UserActivation object accessed via navigator's userActivation property is live, in that changes + in the user activation states will be reflected in the properties of the object.

-
[Exposed=(Window,Worker,AudioWorklet)]
-interface UserActivation {
+  
[Exposed=(Window,Worker,AudioWorklet)]
+interface UserActivation {
   readonly attribute boolean hasBeenActive;
   readonly attribute boolean isActive;
 };
 
 partial interface Navigator {
-  [SameObject] readyonly attribute UserActivation userActivation;
+  [SameObject] readonly attribute UserActivation userActivation;
 };
- -
navigator . userActivation
- +
navigator.userActivation.hasBeenActive
- -

Returns the a live object representing the current user activation states.

- -
- -
userActivation . hasBeenActive
- -
-

Returns the state of the sticky activation.

-
-
userActivation . isActive
- +
navigator.userActivation.isActive
-

Returns the state of the transient activation.

-
-
From b4912a83b5b532f8108d14cda03e64393b707844 Mon Sep 17 00:00:00 2001 From: Mustaq Ahmed Date: Thu, 8 Sep 2022 11:42:48 -0400 Subject: [PATCH 4/6] Make UserActivation an object in Window --- source | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source b/source index eeb7291ca9e..9d9ee5c9796 100644 --- a/source +++ b/source @@ -75906,13 +75906,12 @@ END:VCARD

The UserActivation interface

-

The user activation states are exposed via the UserActivation - interface. The UserActivation object accessed via navigator's userActivation property is live, in that changes - in the user activation states will be reflected in the properties of the - object.

+

The user activation states can be accessed using the UserActivation + interface. Each Window object has a corresponding UserActivation object + which is exposed through navigator's userActivation getter.

-
[Exposed=(Window,Worker,AudioWorklet)]
+  
[Exposed=Window]
 interface UserActivation {
   readonly attribute boolean hasBeenActive;
   readonly attribute boolean isActive;
@@ -75936,11 +75935,13 @@ partial interface Navigator {
 
   
-

The hasBeenActive attribute - must return the state of the sticky activation.

+

The hasBeenActive getter returns + true if this's relevant global object has sticky activation; + otherwise false.

-

The isActive attribute must return - the state of the transient activation.

+

The isActive getter returns + true if this's relevant global object has transient activation; + otherwise false.

The userActivation attribute must return a live representation of the user activation states.

From f931892b18263ae0c42249c20ce6c1de75baf310 Mon Sep 17 00:00:00 2001 From: Mustaq Ahmed Date: Wed, 14 Sep 2022 11:43:07 -0400 Subject: [PATCH 5/6] Add "associated UserActivation" --- source | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/source b/source index 9d9ee5c9796..5348906174f 100644 --- a/source +++ b/source @@ -75906,10 +75906,11 @@ END:VCARD

The UserActivation interface

-

The user activation states can be accessed using the UserActivation - interface. Each Window object has a corresponding UserActivation object - which is exposed through navigator's userActivation getter.

+

Each Window has an associated UserActivation, which is a + UserActivation object. Upon creation of the Window object, its + associated UserActivation must be set to a new + UserActivation object created in the Window object's relevant Realm.

[Exposed=Window]
 interface UserActivation {
@@ -75921,6 +75922,21 @@ partial interface Navigator {
   [SameObject] readonly attribute UserActivation userActivation;
 };
+
+ +

The hasBeenActive getter + steps are to return true if this's relevant global object has + sticky activation, and false otherwise.

+ +

The isActive getter steps are to + return true if this's relevant global object has transient + activation, and false otherwise.

+ +

The userActivation getter steps + are to return this's associated UserActivation.

+ +
+
navigator.userActivation.hasBeenActive
@@ -75932,22 +75948,6 @@ partial interface Navigator {

Returns the state of the transient activation.

- -
- -

The hasBeenActive getter returns - true if this's relevant global object has sticky activation; - otherwise false.

- -

The isActive getter returns - true if this's relevant global object has transient activation; - otherwise false.

- -

The userActivation attribute must - return a live representation of the user activation states.

- -
-

Activation behavior of elements

Certain elements in HTML have an activation behavior, which means that the user From f17a88a7f4e54d7f47c8c731443aa3eab1b88b82 Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Wed, 14 Sep 2022 15:01:26 -0700 Subject: [PATCH 6/6] Nits --- source | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/source b/source index 5348906174f..7e4911d7c7a 100644 --- a/source +++ b/source @@ -75753,7 +75753,7 @@ END:VCARD

seconds, so that the user can possibly perceive the link between an interaction with the page and the page calling the activation-gated API.

-

These two values imply two boolean user activation states for W:

+

These two values imply two boolean user activation states for W:

Sticky activation
@@ -75922,32 +75922,37 @@ partial interface Navigator { [SameObject] readonly attribute UserActivation userActivation; };
-
- -

The hasBeenActive getter - steps are to return true if this's relevant global object has - sticky activation, and false otherwise.

- -

The isActive getter steps are to - return true if this's relevant global object has transient - activation, and false otherwise.

- -

The userActivation getter steps - are to return this's associated UserActivation.

- -
-
navigator.userActivation.hasBeenActive
-

Returns the state of the sticky activation.

+

Returns whether the window has sticky activation.

navigator.userActivation.isActive
-

Returns the state of the transient activation.

+

Returns whether the window has transient activation.

+ +
+ +

The userActivation getter steps are to return + this's associated UserActivation.

+ +

The hasBeenActive getter steps are to return + true if this's relevant global object has sticky + activation, and false otherwise.

+ +

The isActive getter steps are to return true if + this's relevant global object has transient activation, + and false otherwise.

+ +
+ +

Activation behavior of elements

Certain elements in HTML have an activation behavior, which means that the user