Offscreen WKWebView ignores mouseMoved events only

I'm developing a ScreenSaverView which uses WKWebview internally.

This screensaver responsds to mouse events, and I'm using a helper app which is granted Accessibility permissions to watch mouseEvents and then serializes them to the Screen Saver, where they are recreated and send to the WKWebView.

This all works fine - the WKWebView can respond to mouseDown, mouseUp, MouseDrag, scrollWheel (etc.) events.

The one exception is that mouseMoved events are ignored.

I see a similar issue posted here: https://stackoverflow.com/questions/17057254/when-webview-is-added-to-a-specific-view-in-nswindow-hover-stops-working-how?rq=2 but that's from 2016 so not sure if it's relevant.

Things I've tried:

  1. adding a NSTrackingArea to the WKWebView
  2. setting the parent NSWindow.acceptsMouseEvents = true

By chance, does your WKWebView have CSS to handle :hover events natively in webkit?

Rico

WWDR - DTS - Software Engineer

Yes, the CSS has :hover classes, for example:

.PlayPauseButton:hover {
	  color: #FF0;
	  text-decoration: none;
	  cursor: pointer;
	}

When i run this HTML/CSS in Safari, or in a normal WKWebView in a test app, it all works normally.

Offscreen WKWebView ignores mouseMoved events only
 
 
Q