Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4024100
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:40:47+00:00 2026-05-20T10:40:47+00:00

In my extension I need, under certain circumstances, to display the context menu as

  • 0

In my extension I need, under certain circumstances, to display the context menu as if it had been clicked on a different element. E.g: I right-click on a certain element on a page, but the context menu should be displayed as if under the cursor there wasn’t the element above, but rather a different element I specify.

I tried doing this in the popupshowing handler this by:

window.addEventListener( "load", function() {
    var contextMenu = document.getElementById("contentAreaContextMenu");
    if (contextMenu) {
        contextMenu.addEventListener("popupshowing", function(event) {
            if (document.popupNode !== newElement) {
                event.preventDefault();
                synthesizeMouse(newElement, 2, 2, { type: "contextmenu", button: 2 }, newElement.ownerDocument.defaultView);
            }
        }, false);
    }
}, false );

newElement is the element that should be “clicked on”, and synthesizeMouse is defined here. Unfortunately, it doesn’t work (if I actually click on newElement the context menu is shown correctly, if I click anywhere else the context menu is not shown at all). Can anybody see why this isn’t working?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:40:48+00:00Added an answer on May 20, 2026 at 10:40 am

    This is just a bit of a wild guess, but because you’re doing this while the context menu from the first event is already opening, maybe this is is blocking the context menu from opening again. Try sending the event 10ms later, so that the original context menu has already closed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Talk of Shallow Clone Extension There had been some talk about work on an
I'm writing a Firefox extension and I need to find the ip address of
I am building a chrome extension and I need to be able to execute
I need to access the struts.action.extension value in the struts.xml file from an interceptor.
I need to check file extension when search over a directory. if using re
I need to use two extension methods SqlCommandExtensions & SqlConnectionExtensions http://msdn.microsoft.com/en-us/library/microsoft.practices.enterpriselibrary.windowsazure.transientfaulthandling.sqlazure(v=pandp.50).aspx Here they say
I need to develop small AIR extension for iOS. here's the question: is it
I need to do a cross-domain request in a chrome extension. I know I
My extension is an overlay that has some images inside a toolbar. I need
I have a chrome extension which have a server-side javascript and I need this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.