Intent to Implement and Ship: user activation through long-press gesture

65 views
Skip to first unread message

Mustaq Ahmed

unread,
Apr 25, 2018, 11:29:31 AM4/25/18
to blink-dev

Contact emails

mus...@chromium.org


Summary

The long-press gesture should be considered a user activation because it is a strong signal that the user is interacting with the page.

Motivation

Currently it is impossible for a web app to match the native Android/iOS behavior of vibrating the device on long-press.  This is because in Chromium a long-press gesture is not considered a user activation, so calls to restricted APIs like navigator.vibrate() are blocked.


Demos

With vibration: output.jsbin.com/bonadab

With popup: output.jsbin.com/peruju


Risks

Interoperability and Compatibility

Very low compat risk since major browsers are split in behavior today, see below.  There is no interop today, and we would match Firefox through this feature.


Edge: Partial support (only the popup demo works on Win10, none work on Android).

Firefox: Shipped (both demos work on mobile).

Safari: No signal (no event expose long-press)

Web developers: Positive


Ergonomics

All user-activation gated APIs (popups, vibration, fullscreen, autoplay, and more) will be allowed through long-press gesture.


Activation

The feature should be easy to use as-is.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Is this feature fully tested by web-platform-tests?

We have no web-platform-tests now perhaps each major browser has its own unique behavior.


We would upstream the Chromium tests we are planning to add---Firefox already shows the proposed behavior so upstreaming web-platform tests shouldn’t be a problem.


Link to entry on the feature dashboard

https://www.chromestatus.com/feature/5726389672083456


Requesting approval to ship?

Yes, in M68.


Chris Harrelson

unread,
Apr 26, 2018, 2:26:54 PM4/26/18
to Mustaq Ahmed, blink-dev
LGTM1

Please update the relevant docs that exist already for the notion of user activation (as discussed in previous intents).

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAB0cuO7d6D_d35zzT7DQtpzAJnj-Wbat370R%3D%2BX91Qb%3DmSoJbg%40mail.gmail.com.

Mustaq Ahmed

unread,
Apr 26, 2018, 3:16:50 PM4/26/18
to Chris Harrelson, blink-dev
Hi Chris:

I used the term "activation" in a generic sense, w/o specifically linking this intent to User Activation v2.  In other words, this intent affects both old user activation behavior (based on UserGestureIndicator) and upcoming UAv2.

So I would like to keep my UAv2 doc unchanged if you are okay with that.

(Probably "user gesture" would have been the right word here.  I found it odd to "intent to ship long-press user gestures" while covering only the activation part here and not the "detection" part.  Hopefully this is clearer now.)


Chris Harrelson

unread,
Apr 26, 2018, 4:11:26 PM4/26/18
to Mustaq Ahmed, blink-dev
 How about augmenting the "Triggered by user activation" to reference long-press (phrased as "contextmenu event" I assume?) as a possible source of activation?

Mustaq Ahmed

unread,
Apr 27, 2018, 12:11:06 PM4/27/18
to Chris Harrelson, blink-dev, Domenic Denicola
Good point, thanks.  I will give it a try, I think it's fine to go with this small change before we can settle the main discussion with UAv2.  Domenic, wdyt?

Rick Byers

unread,
Apr 30, 2018, 4:53:47 PM4/30/18
to Mustaq Ahmed, Chris Harrelson, blink-dev, Domenic Denicola
I suspect that it'll be noncontrovercial to add contextmenu to the list of events there in the spec (given that Firefox already seems to do this, and Edge does so partially).  So I suggest putting up a PR for that tweak.

But LGTM2 (not blocking on the spec PR landing since we're actively trying to get spec and impl in closer alignment in this area).

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Mustaq Ahmed

unread,
May 1, 2018, 10:49:47 AM5/1/18
to Rick Byers, Chris Harrelson, blink-dev, Domenic Denicola
Here is a PR to tweak the current spec.

Btw, Domenic asked me to clarify the implications with contextmenu events  on desktop, this is what I found (commented on a forked thread):

> For mouse right click on desktop, both Chromium and Firefox allow vibration already, and Edge
> (doesn't support vibration but) allows popups.  So the spec change with "contextmenu" should be okay.

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.

Ojan Vafai

unread,
May 1, 2018, 1:31:25 PM5/1/18
to Mustaq Ahmed, Rick Byers, Chris Harrelson, blink-dev, Domenic Denicola
Reply all
Reply to author
Forward
0 new messages