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

Treat trusted `contextmenu` events as user activation. #3659

Merged
merged 1 commit into from May 2, 2018

Conversation

4 participants
@mustaqahmed
Copy link
Contributor

mustaqahmed commented May 1, 2018

The contextmenu event should be considered a user activation because it indicates that the user is interacting with the page.

Firefox already treats contextmenu events as user activation, hence allows web apps to use restricted APIs like navigator.vibrate(). In Chromium, we are on track to match the Firefox behavior because on mobile platforms, a web app should be able to mimic the native behavior of vibrating the device on long-press gestures (which fire contextmenu events). Here is a demo.

Note that on desktop, both Chromium and Firefox already treat contextmenu events as user activation (e.g. navigator.vibrate returns true in the above demo).

This PR is remotely related to #1903 (which is a work in progress in Chromium).


/acknowledgements.html ( diff )
/interaction.html ( diff )

@RByers

This comment has been minimized.

Copy link

RByers commented May 1, 2018

FWIW, this change makes sense to me as a small incremental step, largely separate from Mustaq's larger effort of rationalizing/simplifying this whole space.

@domenic

domenic approved these changes May 1, 2018

Copy link
Member

domenic left a comment

This looks good to me, and brings the spec a bit more in line with existing browsers while we work on #1903. I think it's OK to forgo tests since testing user activation is not currently possible I believe (e.g. the pop-up blocker is always disabled in the web platform tests infra). I am hopeful that when we do #1903 we'll try to workaround those current testing limitations and have a larger set of tests for the whole space.

I'll give this another day to see if any other editors have thoughts, and then merge.

@annevk

This comment has been minimized.

Copy link
Member

annevk commented May 2, 2018

Is there an issue on testing being impossible? We should at least reference this so that when that issue gets resolved someone can pick up the slack...

@annevk

This comment has been minimized.

Copy link
Member

annevk commented May 2, 2018

Also, it appears this list was in lexicographical order. Seems worth preserving?

@annevk

This comment has been minimized.

Copy link
Member

annevk commented May 2, 2018

Finally, @mustaqahmed, you don't appear to be listed in the Acknowledgments section. Would you like to add yourself?

@mustaqahmed mustaqahmed force-pushed the mustaqahmed:master branch from fb78d9e to ff41c10 May 2, 2018

@mustaqahmed

This comment has been minimized.

Copy link
Contributor Author

mustaqahmed commented May 2, 2018

  • Testing: Yes, testing is a pain today, and the blame goes to #1903 again. I have added a wpt in my Chromium CL, ptal.

    • I am using navigator.vibrate to test activation because currently only Chrome and Firefox are expected to pass the test, and both of them support navigator.vibrate.
    • I originally hoped to use window.open instead because all browsers support it. However, diffs in popup blocker behavior turned out to be tricky.
    • I also tried Element.requestFullscreen() but didn't want to add prefix-specific switches.
  • Event ordering: Done.

  • Acknowledgements: Done.

chromium-wpt-export-bot added a commit to web-platform-tests/wpt that referenced this pull request May 2, 2018

Treat long-press gesture as a user activation.
Also add a web-platform-test for this change, which is already
supported by Firefox.

Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/-2AyrUFwXvY/Q_wCUmKSAgAJ
Spec change PR: whatwg/html#3659

Bug: 836401
Change-Id: Ia710190857211684ce5ce7d4ff835b874f658b29
@domenic

This comment has been minimized.

Copy link
Member

domenic commented May 2, 2018

Oh, neat. I know the pop-up blocker is disabled for web platform tests, but I didn't realize navigator.vibrate would go through a different code path.

@annevk

annevk approved these changes May 2, 2018

@annevk annevk merged commit 51bd770 into whatwg:master May 2, 2018

2 checks passed

Participation mustaqahmed participates on behalf of Google LLC
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

aarongable pushed a commit to chromium/chromium that referenced this pull request May 2, 2018

Treat long-press gesture as a user activation.
Also add a web-platform-test for this change, which is already
supported by Firefox.

Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/-2AyrUFwXvY/Q_wCUmKSAgAJ
Spec change PR: whatwg/html#3659

Bug: 836401
Change-Id: Ia710190857211684ce5ce7d4ff835b874f658b29
Reviewed-on: https://chromium-review.googlesource.com/1039265
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555450}

chromium-wpt-export-bot added a commit to web-platform-tests/wpt that referenced this pull request May 2, 2018

Treat long-press gesture as a user activation.
Also add a web-platform-test for this change, which is already
supported by Firefox.

Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/-2AyrUFwXvY/Q_wCUmKSAgAJ
Spec change PR: whatwg/html#3659

Bug: 836401
Change-Id: Ia710190857211684ce5ce7d4ff835b874f658b29
Reviewed-on: https://chromium-review.googlesource.com/1039265
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555450}

chromium-wpt-export-bot added a commit to web-platform-tests/wpt that referenced this pull request May 2, 2018

Treat long-press gesture as a user activation.
Also add a web-platform-test for this change, which is already
supported by Firefox.

Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/-2AyrUFwXvY/Q_wCUmKSAgAJ
Spec change PR: whatwg/html#3659

Bug: 836401
Change-Id: Ia710190857211684ce5ce7d4ff835b874f658b29
Reviewed-on: https://chromium-review.googlesource.com/1039265
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555450}

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request May 8, 2018

Bug 1458650 [wpt PR 10791] - Treat long-press gesture as a user activ…
…ation., a=testonly

Automatic update from web-platform-testsTreat long-press gesture as a user activation.

Also add a web-platform-test for this change, which is already
supported by Firefox.

Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/-2AyrUFwXvY/Q_wCUmKSAgAJ
Spec change PR: whatwg/html#3659

Bug: 836401
Change-Id: Ia710190857211684ce5ce7d4ff835b874f658b29
Reviewed-on: https://chromium-review.googlesource.com/1039265
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555450}

--

wpt-commits: d86d487f8c2b41816e01ecde2116252fbdf4de43
wpt-pr: 10791

mykmelez pushed a commit to mozilla/gecko that referenced this pull request May 9, 2018

Bug 1458650 [wpt PR 10791] - Treat long-press gesture as a user activ…
…ation., a=testonly

Automatic update from web-platform-testsTreat long-press gesture as a user activation.

Also add a web-platform-test for this change, which is already
supported by Firefox.

Intent to ship: https://groups.google.com/a/chromium.org/d/msg/blink-dev/-2AyrUFwXvY/Q_wCUmKSAgAJ
Spec change PR: whatwg/html#3659

Bug: 836401
Change-Id: Ia710190857211684ce5ce7d4ff835b874f658b29
Reviewed-on: https://chromium-review.googlesource.com/1039265
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555450}

--

wpt-commits: d86d487f8c2b41816e01ecde2116252fbdf4de43
wpt-pr: 10791
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment