Skip to content

Commit

Permalink
Merge pull request #537 from erwindon/esc-close
Browse files Browse the repository at this point in the history
use ESC to close the command-box
  • Loading branch information
erwindon authored Sep 3, 2023
2 parents 0499f30 + f05166d commit 5f42498
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions saltgui/static/scripts/CommandBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,16 +416,11 @@ export class CommandBox {

const targetField = document.getElementById("target");
TargetType.autoSelectTargetType(targetField.value);
targetField.onkeyup = (keyUpEvent) => {
if (keyUpEvent.key === "Escape") {
CommandBox.hideManualRun();
}
};

const commandField = document.getElementById("command");
commandField.onkeyup = (keyUpEvent) => {
document.onkeyup = (keyUpEvent) => {
if (keyUpEvent.key === "Escape") {
CommandBox.hideManualRun();
keyUpEvent.stopPropagation();
}
};

Expand Down Expand Up @@ -455,6 +450,8 @@ export class CommandBox {
targetList.appendChild(option);
}

const commandField = document.getElementById("command");

// give another field (which does not have a list) focus first
// because when a field gets focus 2 times in a row,
// the dropdown box opens, and we don't want that...
Expand Down
6 changes: 3 additions & 3 deletions saltgui/static/scripts/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,11 @@ export class Utils {

// hide/show search box (the block may become more complicated later)
const input = pSearchBlock.querySelector("input");
input.onkeyup = (ev) => {
if (ev.key === "Escape") {
input.onkeyup = (keyUpEvent) => {
if (keyUpEvent.key === "Escape") {
Utils._updateTableFilter(pTable, "", menuItems);
Utils.hideShowTableSearchBar(pSearchBlock, pTable);
// return;
keyUpEvent.stopPropagation();
}
};
input.oninput = () => {
Expand Down

0 comments on commit 5f42498

Please sign in to comment.