Bug 215943

Summary: WKUIDelegate's contextMenuConfigurationForElement API method isn't called for images
Product: WebKit Reporter: Ali Juma <ajuma>
Component: WebKit APIAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: achristensen, beidson, dino, gambard, rohitrao, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   

Ali Juma
Reported 2020-08-28 12:15:49 PDT
The public API method -[WKUIDelegate webView:contextMenuConfigurationForElement:completionHandler] is only called for links, not for images. The SPI version (-[WKUIDelegate _webView:contextMenuConfigurationForElement:completionHandler]) does get called for images. This means that WKWebView embedders cannot easily customize the context menu shown for images. The logic for this is in -[WKContentViewInteraction continueContextMenuInteraction:], which does: if (_positionInformation.isLink && [uiDelegate respondsToSelector:@selector(webView:contextMenuConfigurationForElement:completionHandler:)]) { ..... } else if ([uiDelegate respondsToSelector:@selector(_webView:contextMenuConfigurationForElement:completionHandler:)]) { ..... } Could we change the first condition to also include |_positionInformation.isImage|?
Attachments
Radar WebKit Bug Importer
Comment 1 2020-08-29 11:25:40 PDT
Alex Christensen
Comment 2 2020-08-31 18:19:46 PDT
This API was designed to be a replacement for the API it deprecated without substantial changes. We are considering improving the context menu API, and this input is noted.
Note You need to log in before you can comment on or make changes to this bug.