Add or change context menu items
Categories
(GeckoView :: General, enhancement)
Tracking
(Not tracked)
People
(Reporter: pichillilorenzo, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 Safari/537.36
Steps to reproduce:
Using org.mozilla.geckoview.GeckoView, I tried to override the "onCreateContextMenu", "startActionMode(ActionMode.Callback callback)", "ActionMode startActionMode(ActionMode.Callback callback, int type)", and use "setOnCreateContextMenuListener" to be able to add, remove or change the Context Menu items (such as Copy, Paste, Select All, etc.). I also registered the GeckoView instance for context menu using "Activity.registerForContextMenu" method.
The only API available I found related to Context Menus is the "GeckoSession.ContentDelegate.onContextMenu" event, but it won't be called if the user selects a simple text.
There is a JavaScript Web Extension API for menus (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/menus), but it seems they are not available for Android.
Actual results:
None of the above methods/events aren't getting called (except the "GeckoSession.ContentDelegate.onContextMenu" event), so I'm unable to add, for example, a custom menu item, or listen to a specific menu item click event (such as Copy, Paste, etc.).
I'm able to make it work on android.webkit.WebView overriding the "startActionMode(ActionMode.Callback callback)" or "ActionMode startActionMode(ActionMode.Callback callback, int type)" methods.
Expected results:
I should be able to manage (add, remove or change) the Context Menu items (such as Copy, Paste, Select All, etc.) and register a callback that will be called when the user clicks on it.
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Hi pichillilorenzo! You should be able to customize the context menu for selection defining a SelectionActionDelegate on the GeckoSession object.
Description
•