Base: Close settings dialogs when the escape key is pressed

This commit is contained in:
Timothy Flynn
2026-02-12 13:44:44 -05:00
committed by Tim Flynn
parent 25b701296c
commit 0bfa5f3e52
Notes: github-actions[bot] 2026-02-12 23:30:23 +00:00

View File

@@ -585,7 +585,7 @@
ladybird.sendMessage("restoreDefaultSettings");
});
document.querySelectorAll("dialog").forEach(dialog =>
document.querySelectorAll("dialog").forEach(dialog => {
dialog.addEventListener("click", event => {
const rect = dialog.getBoundingClientRect();
@@ -597,8 +597,14 @@
) {
dialog.close();
}
})
);
});
dialog.addEventListener("keydown", event => {
if (event.key === "Escape") {
dialog.close();
}
});
});
document.addEventListener("WebUILoaded", () => {
ladybird.sendMessage("loadCurrentSettings");