Unable to Override "Link with Highlight" in WKWebView

Hello everyone,

I'm working on an app that uses WKWebView.

My app uses a custom menu and we disable the default menu by overriding with:

WKWebAction.canPerformAction()

However, with the new iOS 18.2 release, I am no longer able to override the "Copy Link with Highlight" option that pops up when highlighting a selection as can be seen from the screenshot:

Has anyone found a work around/bypass for this?

Environment

  • iOS Version: iOS 18.2
  • Device: iPhone 13 Pro
  • App platform: iOS
  • Xcode version: 16.1
  • MacOS: 14.5

I also encountered the same problem,Looking forward to someone helping us。

Subclass WKWebView and add this override:

override func buildMenu(with builder: UIMenuBuilder) {
    super.buildMenu(with: builder)
    builder.remove(menu: .share)
}

Unfortunately this also removes the "Share..." menu item, which I'd rather keep... But if you want to remove everything, that's a possibility.

Unfortunately not available on iOS 18.2

Unable to Override "Link with Highlight" in WKWebView
 
 
Q