Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent default browser context-menu #6430

Closed
wants to merge 1 commit into from

Conversation

vince-fugnitto
Copy link
Member

What it does

Fixes #4007

Current Behavior

  • When right-clicking certain content (ex: the application without any editors opened) the default browser menu is displayed. This breaks up the user experience and can become quite annoying.

contextmenu

PR

  • The PR adds additional handling to the window contextmenu event to prevent the default browser behavior. Existing context menus such as for an editor, or widgets remain unchanged.

How to test

Verify Default Behavior

  1. open the application
  2. ensure that no editors are opened
  3. attempt to right-click in the empty area (nothing should happen) - previously the browser context menu was displayed

Verify Regression

  1. open the application
  2. open an editor
  3. right-click within the editor, the editor context menu should be visible
  4. do the same as step 3 with a widget tab

Review checklist

Reminder for reviewers

Signed-off-by: Vincent Fugnitto vincent.fugnitto@ericsson.com

Fixes #4007

Add additional handling to handle `contexmenu` events
which would display the browsers default contextmenu
which breaks up the user experience. The default browser
`contextmenu` is thus disabled.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
@vince-fugnitto vince-fugnitto added the ui/ux issues related to user interface / user experience label Oct 21, 2019
@elaihau
Copy link
Contributor

elaihau commented Oct 22, 2019

Tested in my local env.

I confirm:

  • no context menu was populated when right-clicking the empty area, if no editors were open
  • context menu was populated when right-clicking the editor that is opened in the main, the right, the left, and the bottom panel,
  • no context menu was populated when right-clicking the empty main panel, if the editor was docked in the right, the left, and the bottom panel.

Copy link
Contributor

@elaihau elaihau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me, thank you !

@elaihau
Copy link
Contributor

elaihau commented Oct 22, 2019

I found #6431 when testing but I believe it is a separated issue.

@AndrienkoAleksandr
Copy link
Contributor

Hello @vince-fugnitto , I tested your pr and I see that after merge this one we are losing context menu for terminal. Maybe we should create separated issue to create context menu for terminal.

@vince-fugnitto
Copy link
Member Author

@AndrienkoAleksandr I believe the proper fix for the terminal would be to create it's own context menu in which we can add new items. See #6216.

I can hold off on this PR if you'd like until the context menu for the terminal is created.
Which current functionality do you use in the terminal default browser context-menu?

@akosyakov
Copy link
Member

@AndrienkoAleksandr Could you elaborate why browser context menu is helpful for terminals till #6216 is fixed?

@AndrienkoAleksandr
Copy link
Contributor

Hello. I don't block merge this pr. I only applied information. Currently terminal context menu is useful only to copy and paste text, but we have shortcuts to do that. And yes, we need implement context menu. By the way Do we have an issue for that? And when we will implement context menu paste will be working only with electron. For browser version paste won't work for browser security reason.

@kittaakos
Copy link
Contributor

@vince-fugnitto, please make sure extension developers have an easy way to re-enable the context menus if they want to.

@kittaakos
Copy link
Contributor

kittaakos commented Oct 23, 2019

I have just noticed, the context menu is not available anymore from input and textarea. It should work. For instance, I should be able to cut something via the context menu from the SIW view's input and paste it also via the context menu to the SCM view's textarea.

We can do something similar the VS Code guys did, and enable only certain actions: electron/electron#4068 (Edit: I know the referenced issue is a bit off, I added to show that VS Code has support for the context menu in input and textare, so we cannot disable it either.)

@lmcbout
Copy link
Contributor

lmcbout commented Oct 23, 2019

Tested on Ubuntu 16.04 and Chrome

While testing this PR, I found the following:
Terminal | Problem view: context menu for "Toggle Maximized CTRL +M" is missing (Context menu when selecting the terminal title bar.
If you see the item in the context menu, just select the "explorer" view button to hide + show again the "explorer" view, then try to open the context menu over the terminal view (First occurrence only)

ContextMenuMissingOneItem

Search View: We should have a context menu to "Copy/Paste" as minimal. I know we can use keyboard shortcut to copy/paste, but I would also prefer to have a minimal context menu for some commands .
CopyPasteNoContextMenu

Explorer view: When selecting the context menu over the workspace name, there is no context menu to show the following views:
Npm scripts
Json Outline
FTP Explorere
File Explorer
Test View
ExplorerViewMenu

@vince-fugnitto
Copy link
Member Author

ContextMenuMissingOneItem

This occurs in master as well.

Search View: We should have a context menu to "Copy/Paste" as minimal. I know we can use keyboard shortcut to copy/paste, but I would also prefer to have a minimal context menu for some commands .

This is not in the scope of the PR. I am not adding context menus for widgets.

Explorer view: When selecting the context menu over the workspace name, there is no context menu to show the following views:
Npm scripts
Json Outline
FTP Explorere
File Explorer
Test View

You likely do not have them because you do not have the additional VS Code extensions provided.
They are not there by default in the repository.

Copy link
Contributor

@lmcbout lmcbout left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Item 1: context menu for "Toggle Maximized CTRL +M" is missing
OK, I will open an issue about it

Item 2:
Search View: We should have a context menu to "Copy/Paste" as minimal. I know we can use >>keyboard shortcut to copy/paste, but I would also prefer to have a minimal context menu for some >>commands .

This is not in the scope of the PR. I am not adding context menus for widgets.

By removing the context menu, you also remove the item for the copy/paste which was available on the old context menu. If the context menu is not provided with this PR, you can open a new issue to add it later, I am fine with it.

Item 3: my mistake

@vince-fugnitto
Copy link
Member Author

I have just noticed, the context menu is not available anymore from input and textarea. It should work. For instance, I should be able to cut something via the context menu from the SIW view's input and paste it also via the context menu to the SCM view's textarea.

We can do something similar the VS Code guys did, and enable only certain actions: electron/electron#4068 (Edit: I know the referenced issue is a bit off, I added to show that VS Code has support for the context menu in input and textare, so we cannot disable it either.)

I don't have any real urgency in merging the PR, I'm concerned about the issues you described about how users don't have the contextmenu in input and textarea fields. I believe the consensus is before merging the PR, to address the context menus in those areas?

@vince-fugnitto
Copy link
Member Author

I'll put the pull-request on hold until we complete the following:

@vince-fugnitto vince-fugnitto deleted the vf/browser-context-menu branch September 29, 2022 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui/ux issues related to user interface / user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ui] Right click on editor tab scrollbar shows native menu
6 participants