Disable scrolling of WKWebView in NSScrollView

macos, nsscrollview, objective-c, scroll, wkwebview

Solution

Subclass `WKWebView` and implement the following method:

- (void)scrollWheel:(NSEvent *)event {
    // pass web view scroll events to the next responder. comment
    // this line out if you just want to disable scrolling 
    // altogether.
    //
    [[self nextResponder] scrollWheel:event];
}

Problem

I'd like to disable scrolling of my WKWebView that's inside a NSScrollView on macOS in Swift. I found a way to disable scroll inside the WKWebView with css, tho the WKWebView still stops the NSScrollView from scrolling. Dose anyone know how to do this?

Original source