diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/actionList.js b/packages/node_modules/@node-red/editor-client/src/js/ui/actionList.js index d3155051b..aa5b2f900 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/actionList.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/actionList.js @@ -23,6 +23,7 @@ RED.actionList = (function() { var visible = false; var filterTerm = ""; + var previousActiveElement; function ensureSelectedIsVisible() { var selectedEntry = searchResults.find("li.selected"); @@ -135,6 +136,7 @@ RED.actionList = (function() { return; } if (!visible) { + previousActiveElement = document.activeElement; RED.keyboard.add("*","escape",function(){hide()}); $("#red-ui-header-shade").show(); $("#red-ui-editor-shade").show(); @@ -177,6 +179,10 @@ RED.actionList = (function() { }); } RED.events.emit("actionList:close"); + if (previousActiveElement) { + $(previousActiveElement).trigger("focus"); + previousActiveElement = null; + } } } diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/search.js b/packages/node_modules/@node-red/editor-client/src/js/ui/search.js index dcb147de7..6799385fd 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/search.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/search.js @@ -25,6 +25,7 @@ RED.search = (function() { var index = {}; var keys = []; var results = []; + var previousActiveElement; function indexProperty(node,label,property) { @@ -253,6 +254,7 @@ RED.search = (function() { return; } if (!visible) { + previousActiveElement = document.activeElement; RED.keyboard.add("*","escape",function(){hide()}); $("#red-ui-header-shade").show(); $("#red-ui-editor-shade").show(); @@ -286,6 +288,10 @@ RED.search = (function() { }); } RED.events.emit("search:close"); + if (previousActiveElement) { + $(previousActiveElement).trigger("focus"); + previousActiveElement = null; + } } }