coderef

Gamepad touch buttonsLimited availability

The touched property of a GamepadButton object indicates whether a button capable of detecting touch is currently touched.

Not yet supported in all major browsers — check the table and provide a fallback.

Browser support

DesktopChrome
1–72Not supported
73+Supportedsince Mar 12, 2019
Current: 155
Edge
12–14Not supported
15+Supportedsince Apr 5, 2017
Current: 154
Firefox
1–54Not supported
55+Supportedsince Aug 8, 2017
Current: 157
Safari
✕Not supportedup to 27
Current: 27
MobileChrome Android
18–72Not supported
73+Supportedsince Mar 12, 2019
Current: 155
Firefox Android
4–54Not supported
55+Supportedsince Aug 8, 2017
Current: 157
Safari iOS
✕Not supportedup to 27
Current: 27

How to use

Not supported in Safari, Safari iOS. Use feature detection below and provide a fallback (or a polyfill) for those browsers.

Example

Full syntax and examples are on MDN: touched.

Feature detection

JS · check before using
if ("GamepadButton" in globalThis && "touched" in GamepadButton.prototype) {
  // GamepadButton.touched is available
}