mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Ensure focus returns to the right element after dialogs shown
This commit is contained in:
parent
ae2162beaf
commit
bb67049d90
@ -23,6 +23,7 @@ RED.actionList = (function() {
|
|||||||
var visible = false;
|
var visible = false;
|
||||||
|
|
||||||
var filterTerm = "";
|
var filterTerm = "";
|
||||||
|
var previousActiveElement;
|
||||||
|
|
||||||
function ensureSelectedIsVisible() {
|
function ensureSelectedIsVisible() {
|
||||||
var selectedEntry = searchResults.find("li.selected");
|
var selectedEntry = searchResults.find("li.selected");
|
||||||
@ -135,6 +136,7 @@ RED.actionList = (function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
|
previousActiveElement = document.activeElement;
|
||||||
RED.keyboard.add("*","escape",function(){hide()});
|
RED.keyboard.add("*","escape",function(){hide()});
|
||||||
$("#red-ui-header-shade").show();
|
$("#red-ui-header-shade").show();
|
||||||
$("#red-ui-editor-shade").show();
|
$("#red-ui-editor-shade").show();
|
||||||
@ -177,6 +179,10 @@ RED.actionList = (function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
RED.events.emit("actionList:close");
|
RED.events.emit("actionList:close");
|
||||||
|
if (previousActiveElement) {
|
||||||
|
$(previousActiveElement).trigger("focus");
|
||||||
|
previousActiveElement = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ RED.search = (function() {
|
|||||||
var index = {};
|
var index = {};
|
||||||
var keys = [];
|
var keys = [];
|
||||||
var results = [];
|
var results = [];
|
||||||
|
var previousActiveElement;
|
||||||
|
|
||||||
|
|
||||||
function indexProperty(node,label,property) {
|
function indexProperty(node,label,property) {
|
||||||
@ -253,6 +254,7 @@ RED.search = (function() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
|
previousActiveElement = document.activeElement;
|
||||||
RED.keyboard.add("*","escape",function(){hide()});
|
RED.keyboard.add("*","escape",function(){hide()});
|
||||||
$("#red-ui-header-shade").show();
|
$("#red-ui-header-shade").show();
|
||||||
$("#red-ui-editor-shade").show();
|
$("#red-ui-editor-shade").show();
|
||||||
@ -286,6 +288,10 @@ RED.search = (function() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
RED.events.emit("search:close");
|
RED.events.emit("search:close");
|
||||||
|
if (previousActiveElement) {
|
||||||
|
$(previousActiveElement).trigger("focus");
|
||||||
|
previousActiveElement = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user