<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WebKit",
  "identifier" : "/documentation/WebKit/WKUIDelegate/webView(_:contextMenuConfigurationForElement:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WebKit"
    ],
    "preciseIdentifier" : "c:objc(pl)WKUIDelegate(im)webView:contextMenuConfigurationForElement:completionHandler:"
  },
  "title" : "webView(_:contextMenuConfigurationForElement:completionHandler:)"
}
-->

# webView(_:contextMenuConfigurationForElement:completionHandler:)

Tells the delegate that a contextual menu interaction began.

```
optional func webView(_ webView: WKWebView, contextMenuConfigurationForElement elementInfo: WKContextMenuElementInfo, completionHandler: @escaping @MainActor @Sendable (UIContextMenuConfiguration?) -> Void)
```

## Parameters

`webView`

The web view in which the interaction occurred.

`elementInfo`

An object that contains information about the element involved in the interaction.

`completionHandler`

The completion handler for you to call with information about how you want to handle the interaction. This handler block has no return value and takes the following parameter:

- configuration: The <doc://com.apple.documentation/documentation/UIKit/UIContextMenuConfiguration> object that contains the details of how you want to handle the interaction. Specify `nil` for this parameter if you don’t want to show a contextual menu.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)