I've been dealing with the same issue, but with help from Apple devs, I was able to find a solution only for iOS 26. You also need to have the latest version of Xcode (26). If I find a solution for iOS 18.x, I will share it here.
Here's a snippet showing how to override the "Copy Link with Highlight" feature in iOS 26:
class MyWebView: WKWebView {
override func buildMenu(with builder: UIMenuBuilder) {
super.buildMenu(with: builder)
if #available(iOS 26.0, *) {
builder.remove(action: UIAction.Identifier("WKActionScrollToTextFragmentGeneration"))
}
}
}
Topic:
Safari & Web
SubTopic:
General
Tags: