eclipse-platform / eclipse.platform.swt

Eclipse SWT
https://www.eclipse.org/swt/
Eclipse Public License 2.0
118 stars 139 forks source link

Browser: Add option to force showing browser-native context menu? #1585

Open sratz opened 2 weeks ago

sratz commented 2 weeks ago

When setting a custom menu to a Browser the browser-native context menu is suppressed.

The native menu, however, is typically the entry point to browser troubleshooting and debug tools. Accessing them is cumbersome and requires code changes to temporarily remove the menu customization.

For troubleshooting / development use-cases it would be nice to have Browser ignore suppressed context menus and always show the native context menu.

I am thinking about having a VM parameter such as org.eclipse.swt.browser.ignoreSuppressedContextMenu=true or similar to force-enable the native context menu.

This menu might then show in addition to the custom menu.

@HeikoKlare wdyt?

laeubi commented 2 weeks ago

I am thinking about having a VM parameter such as org.eclipse.swt.browser.ignoreSuppressedContextMenu=true or similar to force-enable the native context menu.

Should it from SWT perspective not being some kind of SWT.SHOW_NATIVE_MENU? Of course users can pass this flag then based on a system property of their choice.

sratz commented 2 weeks ago

I am thinking about having a VM parameter such as org.eclipse.swt.browser.ignoreSuppressedContextMenu=true or similar to force-enable the native context menu.

Should it from SWT perspective not being some kind of SWT.SHOW_NATIVE_MENU? Of course users can pass this flag then based on a system property of their choice.

We already can do that with the current API:

if (vm parameter not set) {
  browser.setMenu(...);
}

but it requires each consumer to handle this.

I am looking for a more central I want to debug Browser / javascript, please let me access the context menu / dev tools switch.

HeikoKlare commented 2 weeks ago

The proposal sounds reasonable to me. When I ran into the situation that I wanted to have the native context menu when a custom one was implemented, I also manually changed the according code temporarily. So I definitely see a use case for this.

N1k145 commented 2 weeks ago

With 2024-06 it was possible to press F12 to open the Edge Debug Menu, with 2024-09 this is no longer working. This could also be an Entrypoint for debugging with the/a corresponding Flag.