Bug 217675 - Allow gamepad button press to count as a user gesture
Summary: Allow gamepad button press to count as a user gesture
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: Safari 14
Hardware: Unspecified All
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-10-13 15:12 PDT by Justin Uberti
Modified: 2024-05-13 16:51 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Uberti 2020-10-13 15:12:22 PDT
Many of Safari's APIs require a user gesture, e.g.:
- fullscreen
- autoplay
- clipboard

However it is not possible to trigger a user gesture from an attached USB or Bluetooth gamepad, which makes it hard for apps to entirely drive their UI from a gamepad.

Chrome adopted an approach where a getGamepads() call with at least one button pushed more than 50% triggers a user gesture callback (https://bugs.chromium.org/p/chromium/issues/detail?id=381596#c13). This seems like it would be easy to adopt in Safari as well, assuming this approach gets a thumbs-up.
Comment 1 Radar WebKit Bug Importer 2020-10-14 17:44:50 PDT
<rdar://problem/70315471>
Comment 2 Brady Eidson 2020-10-15 13:02:21 PDT
This seems like a reasonable thing to do.
Comment 3 Justin Uberti 2020-10-15 14:17:47 PDT
OK, great. I'll look at grabbing a UserGestureToken somewhere like https://github.com/WebKit/webkit/blob/89c28d471fae35f1788a0f857067896a10af8974/Source/WebCore/platform/gamepad/GamepadProvider.cpp#L53 and see if that direction will work.