Repository navigation
Description
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
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
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]User activation[/-][+]User activation (2024 edition)[/+]mustaqahmed commentedon Oct 5, 2023
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 commentedon 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 commentedon Oct 10, 2023
@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 commentedon Oct 10, 2023
A possible list of WPTs for Interop 2024 could be all non-tentative tests in
html/user-activation/(dashboard).zcorpan commentedon 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 commentedon 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.