5

I'm writing a web application with a lot of drag and drop functionality and I want to enable haptic feedback (when possible, using macOS 10.11+ with a Force Touch trackpad) for actions like "snapping in" while dragging items.

Is this possible (I know it's impossible to support every platform, but at least when hardware supports it)? I've tried navigator.vibrate with different time values/patterns but it doesn't seem to do anything even if it returns true.

Kaiido
  • 123,334
  • 13
  • 219
  • 285
Can Poyrazoğlu
  • 33,241
  • 48
  • 191
  • 389
  • There is this issue: https://bugs.chromium.org/p/chromium/issues/detail?id=788567 and there was that one: https://bugs.chromium.org/p/chromium/issues/detail?id=628924 TL;DR; while both issues are open, there doesn't seem to be any real intention in supporting these devices particularly. The pointer events don't even notice anything related neither in Chrome nor in Firefox (one could have expected a different `pressure` value for instance). Maybe you could start yet an other FR. (asking for it to be shown in the `pointerrawupdate` event sounds more legit than the two previous FRs I linked to.) – Kaiido Mar 16 '20 at 02:03

1 Answers1

-1

Should work with the Force Touch events, one of which is webkitmouseforcedown

someElement.addEventListener("webkitmouseforcedown", myFunction, false);

You can read more about this and the other events here

Please note that this will work only on Safari unfortunately