Skip to content

Commit 5f42498

Browse files
authored
Merge pull request #537 from erwindon/esc-close
use ESC to close the command-box
2 parents 0499f30 + f05166d commit 5f42498

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

saltgui/static/scripts/CommandBox.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,16 +416,11 @@ export class CommandBox {
416416

417417
const targetField = document.getElementById("target");
418418
TargetType.autoSelectTargetType(targetField.value);
419-
targetField.onkeyup = (keyUpEvent) => {
420-
if (keyUpEvent.key === "Escape") {
421-
CommandBox.hideManualRun();
422-
}
423-
};
424419

425-
const commandField = document.getElementById("command");
426-
commandField.onkeyup = (keyUpEvent) => {
420+
document.onkeyup = (keyUpEvent) => {
427421
if (keyUpEvent.key === "Escape") {
428422
CommandBox.hideManualRun();
423+
keyUpEvent.stopPropagation();
429424
}
430425
};
431426

@@ -455,6 +450,8 @@ export class CommandBox {
455450
targetList.appendChild(option);
456451
}
457452

453+
const commandField = document.getElementById("command");
454+
458455
// give another field (which does not have a list) focus first
459456
// because when a field gets focus 2 times in a row,
460457
// the dropdown box opens, and we don't want that...

saltgui/static/scripts/Utils.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -348,11 +348,11 @@ export class Utils {
348348

349349
// hide/show search box (the block may become more complicated later)
350350
const input = pSearchBlock.querySelector("input");
351-
input.onkeyup = (ev) => {
352-
if (ev.key === "Escape") {
351+
input.onkeyup = (keyUpEvent) => {
352+
if (keyUpEvent.key === "Escape") {
353353
Utils._updateTableFilter(pTable, "", menuItems);
354354
Utils.hideShowTableSearchBar(pSearchBlock, pTable);
355-
// return;
355+
keyUpEvent.stopPropagation();
356356
}
357357
};
358358
input.oninput = () => {

0 commit comments

Comments
 (0)