4

When you select text in Safari (and WKWebView), there is a haptic feedback. I disabled any selection (see code below) on the page I'm opening in WKWebView, and the haptic feedback is still there when I long press anywhere on the WKWebView. How can I disable it?

    * {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
    }
Reedzev_
  • 156
  • 1
  • 5

1 Answers1

2

I'm having the same issue and I found something that seems to work just fine:

let longPress:UILongPressGestureRecognizer = UILongPressGestureRecognizer(target: nil, action: nil)
longPress.minimumPressDuration = 0.2
webView.addGestureRecognizer(longPress)

Taken from Disabling user selection in UIWebView.

Marco
  • 7,007
  • 2
  • 19
  • 49
  • This works great for a single tap, but doesn't work for a double tap held down unless you set `minimumPressDuration = 0.1` (don't ask me why) – edbentley Dec 11 '20 at 10:30