Skip to content

Commit f05166d

Browse files
Erwin Dondorperwindon
authored andcommitted
generalize commandbox-box ESC handler
1 parent 0a10fd3 commit f05166d

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
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...

0 commit comments

Comments
 (0)