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

Feature Request: Trigger page's right-click handler for a link #874

Closed
eeolson opened this issue Jun 21, 2013 · 27 comments
Closed

Feature Request: Trigger page's right-click handler for a link #874

eeolson opened this issue Jun 21, 2013 · 27 comments

Comments

@eeolson
Copy link

eeolson commented Jun 21, 2013

I have to use a web-based management tool a lot in Chrome. Vimium makes it easier to avoid removing my hands from the keyboard. One thing I would love to see is the ability to right-click on a link, rather than just following a link (with f or F). The tool we use uses right-clicking extensively on their site. For example, if I click a client in my home screen, it opens the client details. However, what I usually want to do is right-click the link, and choose "add time", or "add ticket note" etc from the resulting drop-down menu. If Vimium provided a modifier key to make f or F a right click, I could then use the arrow keys to select from the resulting drop-down menu.

@liweinan0423
Copy link

Hi, I just met the same problem with you. I say your comment was posted 1 year ago, is there any update on that?

@mrmr1993
Copy link
Contributor

I've created a branch here which should do the trick, using the LinkHints.activateModeToTriggerRightClickAction command.

This seems like quite a low-demand feature, so I wouldn't expect to see it in the released version any time soon.

@logan85
Copy link

logan85 commented Dec 10, 2014

I need this feature too. I would think this would be very much needed. Just started using vimium a few weeks ago with awesome wm. I love vimium and rarely use the touchpad now. I would use it even less if this feature was available.

@mrmr1993
Copy link
Contributor

@logan85 this doesn't open the context menu unfortunately; there isn't currently any way for us to do that at the moment. The branch I opened is only to right click on pages which handle right click themselves.

Ignore this if that's what you were after :bowtie:

@philc philc changed the title Feature Request: right-click on a link Feature Request: Trigger page's right-click handler for a link Dec 14, 2014
@philc
Copy link
Owner

philc commented Feb 1, 2016

Closing this in favor of #1312.

@philc philc closed this as completed Feb 1, 2016
@dploeger
Copy link

dploeger commented Aug 4, 2016

@philc Isn't this issue about calling the right mouse button event of a link and not about a context menu for a Vimium-Link?

@RamAnvesh
Copy link

Please reopen this issue. This issue talks about triggering browser's context menu of an element in the web page, not a vimium specific one. #1312 talks about a vimium specific menu. Being able to trigger context menu allows users to access other extensions' actions which are added to the context menu of the browser making vimium much more useful. Please reopen.

Waiting for your response.

@smblott-github
Copy link
Collaborator

As far as I know, there is no Chrome API to do this, @RamAnvesh.

@RamAnvesh
Copy link

Thanks for the response. Maybe we can reopen this issue when such an API becomes available

@RamAnvesh
Copy link

RamAnvesh commented Nov 16, 2016

jQuery does this so:

$('#element').triggerHandler('contextmenu');

Are you sure vimium can't do something like this given javascript can?
I am guessing the issue is that vimium doesn't have access to the css selector of the element on the document - is that the case?

Source: http://stackoverflow.com/questions/6250447/trigger-right-click

@smblott-github
Copy link
Collaborator

I suspect this cannot be done from within the Vimium context (e.g., see here.

(The page you quote is for the host page's own Javascript, not an extension.)

@zstarkebaumcalico
Copy link

@smblott-github What I'm running into is not wanting to display the chrome context menu but to fire the JS context menu event to display any context menu registered in the page's javascript for that element. This does appear to be possible per this SO answer https://stackoverflow.com/a/7914742/363522

I would like to propose reopening this issue to implement a LinkHints.activateModeToFireJavascriptContextMenu advanced command, so that those of us that know the webpage is using a JS context menu can fire this and make the context menu dom elements visible for further interaction.

Here is a fiddle with a proof of concept https://jsfiddle.net/g8te46rn/17/

@smblott-github
Copy link
Collaborator

If we were to do this, we would probably add it to #3097 or #3098 (which both implement more or less the same thing, I think).

@zstarkebaumcalico
Copy link

Sounds great, yes it does look like adding contextmenu as an event would work for that. Is there anything I can do to help make it happen?

@paul-cybercitizen
Copy link

I was looking for this feature also, it would be very useful

@chriszrc
Copy link

There is an extremely clear use case for this, which is that all developers inevitably will end up needing to be able to right click on an element in order to inspect it in the chrome developer tools. If right click is out of the question, would it be possible to trigger the inspect element command on a specific page element?

@mrmr1993
Copy link
Contributor

would it be possible to trigger the inspect element command on a specific page element?

No. There's no way to do this in the extension API.

@chriszrc
Copy link

@mrmr1993 ok, thanks for confirming

@mrmr1993
Copy link
Contributor

@chriszrc if this is something you would really like, for either Vimium or some other extension, you could advocate for it in the chromium issue tracker. A full write-up with a proposed API design, motivating use cases, permissions model and analysis, and an evaluation vs the alternatives is most likely to make progress.

If you do decide to do this, please post a link here so that other interested people can follow/support it.

@chriszrc
Copy link

@mrmr1993 OK, I could try to take this on, but I don't have a grasp on an ideal API design or permissions model and analysis...

@mrmr1993
Copy link
Contributor

The existing APIs are probably the best place to start from the design side. Ideally the API should be pretty simple, so deciding where an inspectElement function would live in the namespace would be and describing its type may be enough.

For the permissions model, the chrome.permissions API document might be helpful. The main considerations would be

  • whether the permission should be always optional, always required, or either
  • what the permission should be called
  • whether it should be combined with an existing permission, or be a new one

@innaterebel
Copy link

Link Hints mode now supports focusing a link, so at least the context menu key is usable, though.

@chriszrc
Copy link

@innaterebel hi, what are you using to enable a keyboard shortcut to get the context menu to show up? Shortcat? Karabiner?

@ghost
Copy link

ghost commented Mar 4, 2022

Seems like this is impossible for now. Can't "play with mpv using right click". Had to open the video page & then trigger "play-with-mpv" shortcut.

@dexterleng
Copy link

Hey everyone 👋. I made Homerow, a macOS app inspired by Vimium but for the whole OS. You can right-click and Command-Click (to open link in new tab) on buttons and links.

You can find Homerow at https://homerow.app.

right-click.mp4

@yash-fn
Copy link

yash-fn commented Aug 20, 2023

why not press the menu key on the keyboard (all windows keyboards usually have menu key) then use built-in browser shortcut to select option? i.e.
press v then c to get into caret mode -> make your selection in visual mode
then press menu key (on mine located between right alt and control key)
then press for example s to search highlihgted word in search engine.

@CRTejaswi
Copy link

Visually select the item of page, then press Shift+F10 to emulate right click.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

16 participants