Skip to content

Commit 3babe21

Browse files
authored
Change commands input behaviour with single result (#941)
1 parent f260c40 commit 3babe21

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

static/js/commands-filters.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,21 @@ const FILTERS = {
4343
}
4444
};
4545

46+
nameFilter = FILTERS.name.element
47+
nameFilter.addEventListener('keydown', function (event) {
48+
switch (event.key) {
49+
case "Enter":
50+
visibleCommands = document.querySelectorAll("article.flex.flex-col.gap-2.transition.relative:not([style='display: none;'])")
51+
if (visibleCommands.length == 1) {
52+
event.preventDefault();
53+
commandHref = visibleCommands[0].getElementsByTagName("a")[0].href
54+
window.location.assign(commandHref)
55+
};
56+
default:
57+
return;
58+
}
59+
});
60+
4661
const hiddenCards = [];
4762

4863
function setDisabledVersions(value) {

0 commit comments

Comments
 (0)