Skip to content

Commit

Permalink
FF120 UserInteraction updates
Browse files Browse the repository at this point in the history
  • Loading branch information
hamishwillee committed Oct 31, 2023
1 parent 5bef479 commit 11f95d8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
4 changes: 2 additions & 2 deletions files/en-us/web/api/useractivation/hasbeenactive/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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) {
Expand Down
27 changes: 16 additions & 11 deletions files/en-us/web/api/useractivation/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion files/en-us/web/api/useractivation/isactive/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 11f95d8

Please sign in to comment.