WKWebView UIDelegate Methods Not Being Called on Mac Catalyst (WKUIDelegate)

I have a WKWebView that sets the UIDelegate:

 self.webView.UIDelegate = self;

The following methods are never called when I right click in the WKWebView to being up a context menu:

-(void)webView:(WKWebView*)webView
contextMenuForElement:(WKContextMenuElementInfo*)elementInfo
willCommitWithAnimator:(id <UIContextMenuInteractionCommitAnimating>)animator

-(void)webView:(WKWebView*)webView
contextMenuConfigurationForElement:(WKContextMenuElementInfo*)elementInfo
completionHandler:(void (^)(UIContextMenuConfiguration * _Nullable configuration))completionHandler

- (void)webView:(WKWebView *)webView contextMenuDidEndForElement:(WKContextMenuElementInfo *)elementInfo;

This is from a Mac Catalyst app (I'm on macOS 14.0 23A344)

Replies

Just looked in the header file I see these are stubbed out on Mac Catalyst:

Seems weird that you can't add actions to the context on Mac Catalyst.

I am actually seeing -webView:contextMenuConfigurationForElement:completionHandler: being called sometimes and only when a link is right clicked but I'd like to be able to add context menu items when the background of the page is right clicked.

Can you file an FB ID using Feedback Assistant, or (somewhat better) a bug on <https://bugs.webkit.org/>?

Thanks for your reply. I did file FB13264525

  • Thank you!

Add a Comment