GNOME Bugzilla – Bug 608491
Context menu does not appear when invoked from keyboard
Last modified: 2018-08-03 19:27:39 UTC
Context menu does not work when it's invoked from the keyboard. This is due to epiphany not using Webkit default menu and not handling the menu key in ephy_web_view_key_press_event
Created attachment 154963 [details] [review] Patch This patch solves this problem by making epiphany to use the default WebKit context menu when context menu is invoked using the keyboard.
But we don't want the default webkit context menu, but the ephy one. We might do the same webkit does, create a fake mouse event and handle popup_menu as a right click. The problem is how to get the x, y coodinates of the current selection or focused item. Reading webkit code I've noticed that we are doing the hit test twice beause web_view handles the event and only when it's about to show the menu it checks the settings to decide whether actually show it or not. I think the view could just emit a signal "context-menu", or something like that, once the event has been handled and it has decided not to show the default one. That signal would pass the WebKitHitTestResult so that ephy only have to connet to it and call show_embed_popup(). With this approach we don't even need to get the position of the selection or currently focused item, because it has been already handled by web_view. See also webkit bug: https://bugs.webkit.org/show_bug.cgi?id=49376
Created attachment 175035 [details] [review] ephy-window: Use WebKitWebView::context-menu signal to show the context menu It allows to show the context menu also when triggered with the keyboard. Use webkit_web_inspector_inspect() in popup_cmd_inspect_element() so that we don't need the coords. With this patch EphyEmbedEvent is not used anymore, so we might just remove it. The patch depends on two webkit patches: https://bugs.webkit.org/show_bug.cgi?id=49904 https://bugs.webkit.org/show_bug.cgi?id=49903
Created attachment 175465 [details] [review] Updated patch to work with current webkit Updated patch using webkit_web_inspector_inspect_node()
*** Bug 652302 has been marked as a duplicate of this bug. ***
Created attachment 195767 [details] [review] Use WebKitWebView::context-menu signal to show the context menu Patch updated to current git master and for new webkit patch attached to bug: https://bugs.webkit.org/show_bug.cgi?id=49904 This patch breaks the API, so I'll update ephy extensions too if patches are applied.
The bug is still present but I doubt that the patch is still relevant?
Review of attachment 195767 [details] [review]: Indeed, this patch is obsolete, but the bug still exists. I think we should actually fix this in WebKit. The context menu key is something that should work in all applications, without them having to think about or add it manually.
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/epiphany/issues/139.