mirror of
https://github.com/MathMan05/Fermi.git
synced 2026-05-13 15:05:24 +00:00
Escape out of more menus
This commit is contained in:
@@ -72,6 +72,11 @@ class ImagesDisplay {
|
||||
this.background.onclick = (_) => {
|
||||
this.hide();
|
||||
};
|
||||
this.background.onkeydown = (e) => {
|
||||
if (e.key === "Escape") {
|
||||
this.hide();
|
||||
}
|
||||
};
|
||||
document.body.append(this.background);
|
||||
this.background.setAttribute("tabindex", "0");
|
||||
this.background.focus();
|
||||
|
||||
@@ -878,6 +878,13 @@ class Dialog {
|
||||
removeAni(background);
|
||||
}
|
||||
};
|
||||
background.tabIndex = 0;
|
||||
background.focus();
|
||||
background.onkeydown = (e) => {
|
||||
if (e.key === "Escape" && hideOnClick) {
|
||||
removeAni(background);
|
||||
}
|
||||
};
|
||||
return center;
|
||||
}
|
||||
hide() {
|
||||
|
||||
Reference in New Issue
Block a user