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

Treat trusted contextmenu events as user activation. #3659

Merged
merged 1 commit into from
May 2, 2018

Conversation

mustaqahmed
Copy link
Contributor

@mustaqahmed 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
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.

Copy link
Member

@domenic domenic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
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
Copy link
Member

annevk commented May 2, 2018

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

@annevk
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
Copy link
Contributor Author

mustaqahmed commented May 2, 2018

  • Testing: Yes, testing is a pain today, and the blame goes to Make "triggered by user activation" match browser behavior #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 pushed a commit to web-platform-tests/wpt that referenced this pull request May 2, 2018
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
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 merged commit 51bd770 into whatwg:master May 2, 2018
aarongable pushed a commit to chromium/chromium that referenced this pull request May 2, 2018
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 pushed a commit to web-platform-tests/wpt that referenced this pull request May 2, 2018
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 pushed a commit to web-platform-tests/wpt that referenced this pull request May 2, 2018
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
…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
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 3, 2019
…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 <dtapuskachromium.org>
Commit-Queue: Mustaq Ahmed <mustaqchromium.org>
Cr-Commit-Position: refs/heads/master{#555450}

--

wpt-commits: d86d487f8c2b41816e01ecde2116252fbdf4de43
wpt-pr: 10791

UltraBlame original commit: b83499fcfb6339c99b18654ecf957e180306218f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 3, 2019
…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 <dtapuskachromium.org>
Commit-Queue: Mustaq Ahmed <mustaqchromium.org>
Cr-Commit-Position: refs/heads/master{#555450}

--

wpt-commits: d86d487f8c2b41816e01ecde2116252fbdf4de43
wpt-pr: 10791

UltraBlame original commit: b83499fcfb6339c99b18654ecf957e180306218f
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 3, 2019
…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 <dtapuskachromium.org>
Commit-Queue: Mustaq Ahmed <mustaqchromium.org>
Cr-Commit-Position: refs/heads/master{#555450}

--

wpt-commits: d86d487f8c2b41816e01ecde2116252fbdf4de43
wpt-pr: 10791

UltraBlame original commit: b83499fcfb6339c99b18654ecf957e180306218f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants