1

Certain web sites use web applications that replace the standard web page context menus with their own context menus, but Brave browser will not display them. Other browsers such as Edge, Chrome and Firefox will.

I bring up the site with its web application and attempt to bring up a right-click context menu on some page element. The default page context menu displays, not the application's context menu. I cannot find any setting in Brave that affects this behavior. Other browsers display the application's context menu correctly.

I cannot find anything related to this issue in Brave Help area.

Examples:

Default Menu appears with Brave

Application's Menu Using Chrome

ChazJ
  • 11
  • 3
  • 1
    Can you show the (relevant) code that tries to display the menu? – Alejandro Mar 16 '23 at 17:58
  • 1
    I'm an engineer on the Brave browser, and it sounds to me like there might be a script being blocked on those pages which is otherwise responsible for setting up the custom context menu. After all, websites have no API for augmenting the browser's context menu (AFAIK). An example, or code alone, would be very helpful. – Sampson Mar 16 '23 at 18:56
  • @Sampson - I have Javascript and Pop-ups/Redirects both enabled. I don't see any other settings related to this. – ChazJ Mar 17 '23 at 18:28
  • 1
    From your screenshot I suspect Brave is blocking a script on the site you're visiting. That script is responsible for intercepting right-click events, cancelling them (so no context menu appears), and showing a custom context menu in their place. You should be able to confirm this by disabling the shields via the Brave logo to the right of the address bar. Note, this is bad for security and privacy, and meant only as a means to confirm my suspicion. – Sampson Mar 17 '23 at 19:16
  • Please provide enough code so others can better understand or reproduce the problem. – Community Mar 18 '23 at 14:46

2 Answers2

0

Brave doesn't prevent websites from providing their own context menu via an event-handler on the contextmenu event. For example, the following interactive demo will work inside Brave without issue:

const menu = document.querySelector("#menu");

document.addEventListener("click", (event) => {
  menu.classList.remove("on");
});

document.addEventListener("contextmenu", (event) => {
  event.preventDefault();
  menu.style.top = `${event.clientY}px`;
  menu.style.left = `${event.clientX}px`;
  menu.classList.add("on");
});
#menu {
  position: fixed;
  opacity: 0;
  background: white;
  padding: 0.5em 1em;
  box-shadow: 0.5em 0.5em 2em rgba(0, 0, 0, 0.25);
  transition: opacity 0.25s linear;
}

#menu.on {
  opacity: 1;
  transition: none;
}
<p>Right-click anywhere in this area.</p>

<div id="menu">
  <p>This is a custom context menu.</p>
</div>

Brave does block some scripts from executing in some contexts. If Brave suspects a particular script on a page could be harmful, then it will prevent that script from being loaded, or it may change the behavior of the script in some other manner.

It's likely you have encountered a site which hosts its custom context menu script on a third-party URL, a pattern that may be interpreted by Brave as potentially harmful. To confirm this, click the Brave icon to the right of your address bar and check to see if any scripts were blocked.

Sampson
  • 265,109
  • 74
  • 539
  • 565
  • Thanks for the demo code. Unfortunately, your demo does not work for me either with Brave, while it does in other browsers. So this leads me to believe this issue has nothing to do with the sites I am having problems with, but with my own instance of Brave browser. I checked the shield icon as you suggested and it does not indicate anything was blocked. I disabled the shield and it did not help - same problem. BTW my Brave version is: Version 1.49.120 Chromium: 111.0.5563.64 (Official Build) (64-bit) – ChazJ Mar 18 '23 at 22:48
  • @ChazJ Can you open a *guest window* (via the ☰ menu) and test the demo code there, please? If it works, that would suggest an extension in Brave is very likely blocking these sites from showing their own context menus. – Sampson Mar 19 '23 at 01:41
  • Yes. See my Answer below. – ChazJ Mar 20 '23 at 14:34
0

I found the problem. It was an extension that I must have added in to Chrome at some time and forgot. I disabled it and it is all working now.

I apologize for taking up your time with this non-issue, but I do appreciate your help. At least it pointed me in the right direction.

ChazJ
  • 11
  • 3