Ensure an item in action list is always selected

This commit is contained in:
Nick O'Leary 2019-06-22 20:25:57 +01:00
parent 8c68e76c3e
commit a73c159160
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 8 additions and 1 deletions

View File

@ -49,6 +49,10 @@ RED.actionList = (function() {
filterTerm = $(this).val();
searchResults.editableList('filter');
searchResults.find("li.selected").removeClass("selected");
var children = searchResults.children(":visible");
if (children.length) {
$(children[0]).addClass('selected');
}
}
});
@ -61,7 +65,6 @@ RED.actionList = (function() {
var children = searchResults.children(":visible");
if (children.length) {
$(children[0]).addClass('selected');
RED.a = children[0];
}
} else {
var nextChild = selectedChild.nextAll(":visible").first();
@ -162,6 +165,10 @@ RED.actionList = (function() {
visible = true;
}
searchInput.trigger("focus");
var children = searchResults.children(":visible");
if (children.length) {
$(children[0]).addClass('selected');
}
}
function hide() {