# Quick fix to revert the behaviour of closing the editor window

**URL:** <https://discourse.nodered.org/t/quick-fix-to-revert-the-behaviour-of-closing-the-editor-window/101228>\
**Category:** General\
**Created:** [8 June 2026 23:41 UTC](https://discourse.nodered.org/t/quick-fix-to-revert-the-behaviour-of-closing-the-editor-window/101228 "2026-06-08T23:41:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hazymat](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hazymat/32/108159_2.png) [@hazymat](https://discourse.nodered.org/u/hazymat)\
**Post date:** [8 June 2026 23:41 UTC](https://discourse.nodered.org/t/quick-fix-to-revert-the-behaviour-of-closing-the-editor-window/101228/1 "2026-06-08T23:41:11Z")

</div>

Can anyone improve on this quick fix?

**Problem:**  
Clicking outside the editor window used to close it, and since recent updates this behaviour was changed. (I believe this change may be reverted in a future update but not sure when.)

**Workaround:**  
Pressing Ctrl-Enter doesn't work when the editor window is not in focus. It's possible to set the scope of the shortcut to work globally (thanks @Steve-Mcl)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/b/7b5f3dd72ec315100ad6c2b84a8f3fc63bb95864.png)

**BUT...**  
It has still been annoying me for other reasons - I'll spare you the full tour of my brain's complaint list here though 😄

**Solution**

- Create a file called "editor-fix.js" in .node-red/public:

```auto
(function() {
    RED.events.on("editor:open", function() {
        $("#red-ui-editor-shade").off("mousedown.trayfix");
        $("#red-ui-editor-shade").on("mousedown.trayfix", function(e) {
            if ($(e.target).closest(".red-ui-tray").length === 0) {
                if (!RED.view.dragging && !RED.view.touchDragging) {
                    RED.tray.close();
                }
            }
        });
    });
})();

```

- in .node-red/settings.js, add this

```auto
    page: {
        scripts: [
            "editor-fix.js"
        ]
    }

```

to the `editorTheme` section

**THE ISSUE WITH THIS** : it doesn't save the editor contents (as per previous behaviour) so if anyone knows how to achieve that with a similar "fix" pls let me know 🙂

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [9 June 2026 05:46 UTC](https://discourse.nodered.org/t/quick-fix-to-revert-the-behaviour-of-closing-the-editor-window/101228/2 "2026-06-09T05:46:25Z")

</div>

Instead of RED.tray.close you could probably call the tray close action `RED.actions.invoke('core:confirm-edit-tray')`

NOTE: Node-RED v5 (due very soon) has definitely reverted the tray close behaviour. I am not sure if it made it into the 4.1.x stream or not

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 September 2026 05:46 UTC](https://discourse.nodered.org/t/quick-fix-to-revert-the-behaviour-of-closing-the-editor-window/101228/3 "2026-09-07T05:46:33Z")

</div>

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.
