diff --git a/files/en-us/web/api/useractivation/hasbeenactive/index.md b/files/en-us/web/api/useractivation/hasbeenactive/index.md index 33bf29c58279d26..8eb3bb518cfdcd0 100644 --- a/files/en-us/web/api/useractivation/hasbeenactive/index.md +++ b/files/en-us/web/api/useractivation/hasbeenactive/index.md @@ -8,7 +8,7 @@ browser-compat: api.UserActivation.hasBeenActive {{APIRef("HTML DOM")}} -The read-only **`hasBeenActive`** property of the {{domxref("UserActivation")}} interface indicates whether the current window has sticky user activation (see {{Glossary("sticky activation")}}). +The read-only **`hasBeenActive`** property of the {{domxref("UserActivation")}} interface indicates whether the current window has {{Glossary("sticky activation","sticky user activation")}}. ## Value @@ -18,7 +18,7 @@ A boolean. ### Checking if a user gesture was ever performed -Use the `hasBeenActive` property to check whether the user has ever interacted with the page. +Use the `hasBeenActive` property to check whether the user has interacted with the page since it was loaded. ```js if (navigator.userActivation.hasBeenActive) { diff --git a/files/en-us/web/api/useractivation/index.md b/files/en-us/web/api/useractivation/index.md index 6c9e06290e59adf..be7c61911605d0b 100644 --- a/files/en-us/web/api/useractivation/index.md +++ b/files/en-us/web/api/useractivation/index.md @@ -7,16 +7,7 @@ browser-compat: api.UserActivation {{APIRef("HTML DOM")}} -The **`UserActivation`** interface allows querying information about a window's user activation state. - -A user activation either implies that the user is currently interacting with the page, or has completed an interaction since page load. Typically, this is a click on a button or some other user interaction with the UI. - -There are two kinds of window user activation states: - -- {{Glossary("Transient activation")}} (user is currently interacting with the page) and -- {{Glossary("Sticky activation")}} (user has interacted at least once since page load). - -See [Features gated by user activation](/en-US/docs/Web/Security/User_activation) for more information and a list of APIs that require either sticky or transient user activation. +The **`UserActivation`** interface provides information about whether a user is currently interacting with the page, or has completed an interaction since page load. This API is only available in the window context and not exposed to workers. @@ -27,11 +18,25 @@ This API is only available in the window context and not exposed to workers. - {{domxref("UserActivation.isActive")}} {{ReadOnlyInline}} - : Indicates whether the current window has transient user activation. +## Description + +An object of this type is accessed via the {{domxref("navigator.userActivation")}} property, and can be used to query information about a window's user activation state. + +A user activation either implies that the user is currently interacting with the page, or has completed an interaction since page load. +User activation can be triggered by a button click, pointer touch, or some other user interaction with the page. + +There are two kinds of window user activation states: + +- {{Glossary("Transient activation")}} (user is currently interacting with the page) and +- {{Glossary("Sticky activation")}} (user has interacted at least once since page load). + +See [Features gated by user activation](/en-US/docs/Web/Security/User_activation) for more information and a list of APIs that require either sticky or transient user activation. + ## Examples ### Checking if a user gesture was recently performed -Use {{domxref("UserActivation.isActive")}} to check whether the user is currently interacting with the page ({{Glossary("Transient activation")}}). +Use {{domxref("navigator.userActivation")}} to access the `UserActivation` object, and then {{domxref("UserActivation.isActive")}} to check whether the user is currently interacting with the page ({{Glossary("Transient activation")}}). ```js if (navigator.userActivation.isActive) { diff --git a/files/en-us/web/api/useractivation/isactive/index.md b/files/en-us/web/api/useractivation/isactive/index.md index b3ba41a4ec3c607..14bccaa3d502e1e 100644 --- a/files/en-us/web/api/useractivation/isactive/index.md +++ b/files/en-us/web/api/useractivation/isactive/index.md @@ -8,7 +8,7 @@ browser-compat: api.UserActivation.isActive {{APIRef("HTML DOM")}} -The read-only **`isActive`** property of the {{domxref("UserActivation")}} interface indicates whether the current window has transient user activation (see {{Glossary("transient activation")}}). +The read-only **`isActive`** property of the {{domxref("UserActivation")}} interface indicates whether the current window has {{Glossary("transient activation", "transient user activation")}}. ## Value