Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

User activation (2024 edition) #428

Closed
2 of 3 tasks
AshleyScirra opened this issue Sep 15, 2023 · 6 comments
Closed
2 of 3 tasks

User activation (2024 edition) #428

AshleyScirra opened this issue Sep 15, 2023 · 6 comments
Labels
focus-area-proposal Focus Area Proposal

Comments

@AshleyScirra
Copy link

AshleyScirra commented Sep 15, 2023

Description

Please note this is a re-submission of an Interop 2023 proposal that was not accepted last time around. There is an existing discussion on the original issue #142.

There was a long discussion on the prior issue. I will attempt to summarize it. The modern specification refers to "User activation" which is used to restrict certain actions that require user input, such as entering fullscreen mode. This involves two flags and a short timeout, and can be accessed via the navigator.userActivation JavaScript API.

Prior to that, the old user activation model was essentially that the API had to be called synchronously within an allowed event handler (or possibly some other non-standard restrictions). This causes problems using things like async code, where doing anything async means the call is no longer made synchronously inside the event handler, and so is blocked. The modern user activation rules solve this problem, providing the call is made in a reasonably timely fashion.

It appears that some web APIs use the modern user activation system, but some older web APIs use the old synchronous model (or some other restrictions). This makes the platform inconsistent, for example meaning developers can use async code with certain APIs but not others, and unnecessarily restricts the ability to use some older APIs.

This proposal is to align all web APIs that have any user activation requirement to use the modern model, and to support the navigator.userActivation API so web content can programmatically understand its own restrictions.

Possibly affected APIs

This is a non-exhaustive list of potentially affected APIs determined by basically listing every API mentioned in the original issue #142. They may all have a different status and some APIs may be affected but not listed here.

  • Clipboard API
  • Form input elements (DateTimeChooser, ColorInput, FileInputType...)
  • Fullscreen API
  • Notifications API
  • Payment Request API
  • Push API
  • Vibration API
  • Wake Lock API
  • Web Audio API
  • Web Bluetooth API
  • Web Share API
  • WebUSB API
  • Web XR Device API
  • window.open

Specification

https://html.spec.whatwg.org/multipage/interaction.html#tracking-user-activation

Open Issues

Not aware of any

Tests

At a minimum these WPT tests: https://wpt.fyi/results/html/user-activation
but there may need to be tests for each affected API as well.

Current Implementations

  • Blink
  • Gecko
  • WebKit

Standards Positions

AFAIK all major browsers implement modern user activation at least partially.

Browser bug reports

No response

Developer discussions

Extensive prior discussion at #142. This comment also mentioned:

User gestures is a P2 for Google's closure library

Polls & Surveys

No response

Existing Usage

No response

Workarounds

It's usually possible to work with the old model by deferring actions until the next user activation, or asking the user for a user activation, e.g. showing a dialog to collect a click.

Accessibility Impact

Web apps may be easier to use if it does not have to revert to workarounds such as showing a dialog and requiring another action to complete a task.

Privacy Impact

No response

Other

No response

@AshleyScirra AshleyScirra added the focus-area-proposal Focus Area Proposal label Sep 15, 2023
@AshleyScirra AshleyScirra changed the title User activation User activation (2024 edition) Sep 15, 2023
@mustaqahmed
Copy link
Member

Thanks @AshleyScirra. This is a very timely proposal, specially because the API to query User Activation state (which significantly eases testing) seems to be in "shipped" or "almost-shipped" state in all major browsers (Blink, Mozilla, WebKit).

I am expecting to propose a list of WPTs as a possible Interop 2024 goal here, ETA in a week.

@marcoscaceres marcoscaceres mentioned this issue Oct 6, 2023
3 tasks
@marcoscaceres
Copy link

marcoscaceres commented Oct 6, 2023

Hopefully this gets picked. I'm sitting on a bunch of tests fixes that I haven't been able to get anyone to review on the WebKit side: WebKit/WebKit#14229

Independently, @mustaqahmed, maybe I can bring the over to WPT and you can help review them so we can get them landed? (then I can import them into WebKit that way)

@mustaqahmed
Copy link
Member

@marcoscaceres It's great to see your commitment to improve the WPTs here. Please go ahead with a PR to look into this together.

@mustaqahmed
Copy link
Member

A possible list of WPTs for Interop 2024 could be all non-tentative tests in html/user-activation/ (dashboard).

@zcorpan
Copy link
Member

zcorpan commented Oct 11, 2023

I checked Blink and WebKit as current implementations, per https://caniuse.com/mdn-api_useractivation

Intent to Prototype and Ship for Gecko: https://groups.google.com/a/mozilla.org/g/dev-platform/c/YpjKfr4MQIE (cc @CanadaHonk)

@foolip
Copy link
Member

foolip commented Feb 1, 2024

Thank you for proposing user activation for inclusion in Interop 2024.

We wanted to let you know that this proposal was not selected to be part of Interop this year.

This is because we got many more proposals than we could include in this year's project. Note that individual vendors may nevertheless choose to advance work in this area during the forthcoming year. We would welcome this proposal being resubmitted again next year if necessary.

For an overview of our process, see proposal selection. Thank you again for contributing to Interop 2024!

Posted on behalf of the Interop team.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus-area-proposal Focus Area Proposal
Projects
Status: Done
Development

No branches or pull requests

5 participants