---
title: "webView(_:contextMenuConfigurationForElement:completionHandler:)"
framework: webkit
role: symbol
role_heading: Instance Method
path: "webkit/wkuidelegate/webview(_:contextmenuconfigurationforelement:completionhandler:)"
---

# webView(_:contextMenuConfigurationForElement:completionHandler:)

Tells the delegate that a contextual menu interaction began.

## Declaration

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

```swift
optional func webView(_ webView: WKWebView, contextMenuConfigurationFor elementInfo: WKContextMenuElementInfo) async -> UIContextMenuConfiguration?
```

## 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:

## See Also

### Displaying a contextual menu

- [Adding context menus in your app](uikit/adding-context-menus-in-your-app.md)
- [webView(_:contextMenuForElement:willCommitWithAnimator:)](webkit/wkuidelegate/webview(_:contextmenuforelement:willcommitwithanimator:).md)
- [webView(_:contextMenuWillPresentForElement:)](webkit/wkuidelegate/webview(_:contextmenuwillpresentforelement:).md)
- [webView(_:contextMenuDidEndForElement:)](webkit/wkuidelegate/webview(_:contextmenudidendforelement:).md)
- [UIContextMenuConfiguration](uikit/uicontextmenuconfiguration.md)
