sydcanem / bootstrap-contextmenu

Context menu plugin for Twitter's Bootstrap framework
http://sydcanem.com/bootstrap-contextmenu/
644 stars 193 forks source link

open contextmenu using PC keyboard's menu button #74

Open yeban opened 9 years ago

yeban commented 9 years ago

Menu key - http://en.wikipedia.org/wiki/Menu_key.

Tested this on an Ubuntu machine. The element which triggers contextmenu on right click was selected / focussed. Then pressed the menu button. Browser's contextmenu opens, not bootstrap-contextmenu.

I digged in a bit more and 'contextmenu' event is tiggered on pressing menu key. So it would seem bootstrap-contextmenu is somehow missing that event? If no, I would appreciate any advice with regards to what could be wrong / how can I debug this in my setup.

sydcanem commented 9 years ago

I currently don't have access to such key. I believe when the context menu is triggered by a keyboard input, the event is usually triggered on document element. Can you set the document as the context and check if the plugin context menu opens?

yeban commented 9 years ago

So I did $(document).contextmenu({target: '#contextmenu'}). I believe that's what you meant by setting document as the context. It works - pressing menu key opens bootstrap-contextmenu. But now right clicking anywhere in the document opens bootstrap-context menu. I want to open bootstrap-contextmenu only when clicking on particular elements. How do I do that?