# \[Announce\] node-red-contrib-ui-contextmenu

**URL:** <https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211>\
**Category:** Share Your Nodes\
**Created:** [2 October 2019 18:05 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211 "2019-10-02T18:05:53Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [18 February 2020 22:58 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/21 "2020-02-18T22:58:15Z")

</div>

I have updated the info panel and the readme file, and published version _ **1.0.9** _ on npm:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/1/816277b0215872b647eb88c13e6c7a66c045a871.png)

> [@Christian-Me](#):
>
> Just for you to know the installation \*over the old version" spit out two warnings:

Seems the [ws](https://www.npmjs.com/package/ws) package is a dependency of some other node that you have installed, and that ws package has peer dependencies (which are not installed automatically anymore since npm version xxx). Cannot do anything about that, since the context-menu node has [no](https://github.com/bartbutenaers/node-red-contrib-ui-contextmenu/blob/master/package.json#L5) dependencies...

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [26 February 2020 09:49 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/22 "2020-02-26T09:49:28Z")

</div>

Sorry to be the one to say (again!!) @BartButenaers but it's not working here.. 🙁

I've configured the node as per the readme, using a simple fixed menu, but it does not appear in the dashboard group.

Checking my browser console, I see the following;

 ![menu1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/e/5ee0d31031897dcd81a637d167f4481d82221c12.jpeg)

If I try and load `https://nodered.digitalnut.co.uk:8443/ui/ui_context_menu/contextmenu.js?_=1582707759368` in a browser (as per the 401 error above) I get a prompt for auth. If I enter my user/password, then the [contents of this file](https://github.com/bartbutenaers/node-red-contrib-ui-contextmenu/blob/master/lib/contextmenu.js) is then displayed.  
The same applies with `https://nodered.digitalnut.co.uk:8443/ui/ui_context_menu/contextmenu.css`, again I'm prompted for auth.

I'm assuming that this is because I've password protected the Node-RED editor, admin API & the node-defined HTTP endpoints using `adminAuth` & `httpNodeAuth` (remember we had similar issues with node-red-contrib-xterm).

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [26 February 2020 11:50 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/23 "2020-02-26T11:50:36Z")

</div>

> [@Paul-Reed](#):
>
> remember we had similar issues with node-red-contrib-xterm

Hey Paul,  
pfffff ...  
But the xterm [problem](https://discourse.nodered.org/t/unauthorized-when-accessing-custom-admin-endpoint/20201/2) was about the admin endpoint with needspermission. For the UI node we use RED.httpNode and that doesn't use needspermission. I have no idea at the moment ...  
And my lunch break is over ...

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [27 February 2020 19:25 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/24 "2020-02-27T19:25:31Z")

</div>

> [@Paul-Reed](#):
>
> I get a prompt for auth

Hey Paul (@Paul-Reed) ,  
Sorry for keeping you waiting...  
Hopefully somebody can give me a tip where to start searching, because I have no idea 🥴  
In my [context\_menu.js](https://github.com/bartbutenaers/node-red-contrib-ui-contextmenu/blob/master/context_menu.js#L559) file, I publish my third party (js and css) files to the browser like I do in all my other UI nodes:

```auto
    // By default the UI path in the settings.js file will be in comment:
    // //ui: { path: "ui" },
    // But as soon as the user has specified a custom UI path there, we will need to use that path:
    // ui: { path: "mypath" },
    var uiPath = ((RED.settings.ui || {}).path) || 'ui';
	
    // Create the complete server-side path
    uiPath = '/' + uiPath + '/ui_context_menu/*';
    
    // Replace a sequence of multiple slashes (e.g. // or ///) by a single one
    uiPath = uiPath.replace(/\/+/g, '/');
	 
    RED.httpNode.get(uiPath, function (req, res) {
        var options = {
            root: __dirname + '/lib/',
            dotfiles: 'deny'
        };
        res.sendFile(req.params[0], options)
    });

```

I assume that the uiPath is determined correctly, since you can access the RED.httpNode endpoint (after you have entered your credentials).

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [27 February 2020 21:32 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/25 "2020-02-27T21:32:45Z")

</div>

> [@BartButenaers](#):
>
> Sorry for keeping you waiting...

I'm in no rush 😉 - I'm using a ui-dropdown node in the meantime, but it's a bit ugly!

_For info,_ my node-RED is script installed

- Node-RED version: v1.0.3
- Node.js version: v10.19.0
- Dashboard version 2.19.4
- Oracle Linux 4.14.35

But other than adding `adminAuth` & `httpNodeAuth`, it's a vanilla installation, so assume others with NR security enabled would have the same problem.

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [28 February 2020 20:03 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/26 "2020-02-28T20:03:58Z")

</div>

I don't know if it helps, but I've just removed all the security settings in node-RED, and the contextmenu node functions without errors.

Adding them back, it appears that when `httpNodeAuth` is enabled, that is what causes the 401 error messages.

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [28 February 2020 22:09 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/27 "2020-02-28T22:09:35Z")

</div>

Could it be possibly related to the (unsolved) situation seen here?

> [@Uibuilder uibindex not working](https://discourse.nodered.org/t/uibuilder-uibindex-not-working/22116):
>
> I'm running uibuilder on ubuntu installed on a user account $home/.node-red/uibuilder When I tried to access uibindex via Show Detailed Information icon, I got this error msg Unauthorized May I know how do I troubleshoot this issue ? Thanks

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [28 February 2020 22:15 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/28 "2020-02-28T22:15:05Z")

</div>

> [@Paul-Reed](#):
>
> `httpNodeAuth`

Hi Lena,  
When I set the `httpNodeAuth ` in my settings.js file, it also fails for me. I'm now trying to debug it. Below is the call stack of my endpoint (i.e. the happy path), in case the httpNodeAuth is not activated:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5b2233d21d7076241fd8cfd7752fb763404e7257.png)  
So somewhere in between it fails to access the endpoint...

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [28 February 2020 22:19 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/29 "2020-02-28T22:19:42Z")

</div>

If I can find a moment tomorrow I’ll compare the uibuilder stack with this one. See where it goes out on both... I’m curious for sure what’s causing this

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [1 March 2020 22:05 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/30 "2020-03-01T22:05:56Z")

</div>

For my issue, this has now been resolved. see [Node-red-ui-table fails when httpNodeAuth enabled](https://discourse.nodered.org/t/node-red-ui-table-fails-when-httpnodeauth-enabled/22425/4)

---

<div class="post-metadata">

**Author:** ![Christian-Me](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/christian-me/32/10774_2.png) [@Christian-Me](https://discourse.nodered.org/u/Christian-Me)\
**Post date:** [2 March 2020 06:14 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/31 "2020-03-02T06:14:10Z")

</div>

Hi Bart, Hi Steve,

I just observed a strange thing. When I do a page refresh in chrome 80.0.3987.122 (64-Bit) on windows 10 (not tested elsewhere) my two context menus pops up on the last position they where used:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/e/4ec75c3d109f5695f26f8b8c17786d5b687ada4a.png)

perhaps it has something to do with the dashboard replaying the last message when a session connects, because no message is triggering this (checked with debug nodes). Timers are not started / working, only after I hovered over the menus once.

I'm using Node-RED 1.0.3 and dashboard 2.19.4 on windows 10.

BTW: It`s always the last position where it was triggered the last time:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/d/adf0ccaec930334a6977523051ae0dccf590689b.png)

---

<div class="post-metadata">

**Author:** ![JGKK](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/jgkk/32/18515_2.png) [@JGKK](https://discourse.nodered.org/u/JGKK)\
**Post date:** [2 March 2020 06:21 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/32 "2020-03-02T06:21:16Z")

</div>

I have the same on Ios, when I change to a tab that contains context menus all context menus I used the last time I was on the tab are displayed until i either tap them away or do a refresh with ui control.

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [2 March 2020 07:30 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/33 "2020-03-02T07:30:16Z")

</div>

Last week I have created a new version of the contextmenu node, which should have solved that issue ( in combination with dashboard 0.19.4 or above). You are using the latest contextmenu node version?

You can find more details about the solution [here](https://discourse.nodered.org/t/api-addwidget/13604/24).

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [2 March 2020 21:52 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/34 "2020-03-02T21:52:27Z")

</div>

Is there anyway the menu can always be on the uppermost layer.

![layer](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/b/4ba5798354ec38e937bfce96fe2081d43e276b5a.gif)

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [2 March 2020 21:53 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/35 "2020-03-02T21:53:53Z")

</div>

Can't that be done (@BartButenaers) by adding a ridiculously high z-index on the css?

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [2 March 2020 22:28 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/36 "2020-03-02T22:28:47Z")

</div>

Hi Paul,  
Indeed like @afelix says the _ **z-index** _ could solve it. However I had some problems with that in the past, in combination with other style elements (e.g. position)...

But let's try.... I have [added](https://github.com/bartbutenaers/node-red-contrib-ui-contextmenu/blob/master/context_menu.js#L162) it on the surrounding DIV element:

```auto
<div id='div_" + node.config.id + "' style='z-index: 999999;' ...

```

You can install it directly from my Github repository:

```auto
npm install bartbutenaers/node-red-contrib-ui-contextmenu

```

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [2 March 2020 22:35 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/37 "2020-03-02T22:35:59Z")

</div>

```auto
[opc@digitalnut .node-red]$ npm install bartbutenaers/node-red-contrib-ui-contextmenu
npm WARN Master_flow@0.0.1 No repository field.
npm WARN Master_flow@0.0.1 No license field.

+ node-red-contrib-ui-contextmenu@1.0.9
updated 1 package and audited 1250 packages in 13.621s

15 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

```

Still the same I'm afraid in incognito browser.

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [2 March 2020 22:42 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/38 "2020-03-02T22:42:15Z")

</div>

@BartButenaers @Paul-Reed, coming back to the issue from this last weekend for a moment... Bart, does your node add things to the appcache of the dashboard, or is it compiled/minified to it? Paul, can you try resetting it again through chrome://... like you did before and see if it changes anything?

---

<div class="post-metadata">

**Author:** ![Paul-Reed](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/paul-reed/32/66906_2.png) [@Paul-Reed](https://discourse.nodered.org/u/Paul-Reed)\
**Post date:** [2 March 2020 22:55 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/39 "2020-03-02T22:55:28Z")

</div>

No still the same Lena.

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [3 March 2020 00:03 UTC](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211/40 "2020-03-03T00:03:29Z")

</div>

Okay, means I can trash that line of thought.

[Previous page](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211.md?page=1)

[Next page](https://discourse.nodered.org/t/announce-node-red-contrib-ui-contextmenu/16211.md?page=3)
