From b6624612cd1c3b7c7494e86a52ea2c8a8ff37e57 Mon Sep 17 00:00:00 2001 From: Zander Otavka <8042691+AlexanderOtavka@users.noreply.github.com> Date: Mon, 4 May 2026 01:21:43 -0700 Subject: [PATCH] no-bug: Submit workspace creation form on Enter and cancel on Escape (gh-13549) Co-authored-by: Zander Otavka Co-authored-by: mr. m <91018726+mr-cheffy@users.noreply.github.com> --- src/zen/glance/zen-glance.css | 1 + src/zen/spaces/ZenSpaceCreation.mjs | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/zen/glance/zen-glance.css b/src/zen/glance/zen-glance.css index b3e6d1190..0c03d05a6 100644 --- a/src/zen/glance/zen-glance.css +++ b/src/zen/glance/zen-glance.css @@ -83,6 +83,7 @@ & label { max-width: 4rem; margin-left: 8px; + color: white; } & image { diff --git a/src/zen/spaces/ZenSpaceCreation.mjs b/src/zen/spaces/ZenSpaceCreation.mjs index 18243b48d..26690eabf 100644 --- a/src/zen/spaces/ZenSpaceCreation.mjs +++ b/src/zen/spaces/ZenSpaceCreation.mjs @@ -148,6 +148,28 @@ class nsZenWorkspaceCreation extends MozXULElement { this.createButton.disabled = !this.inputName.value.trim(); }); + this.inputName.addEventListener("keydown", event => { + if (event.key === "Enter") { + event.preventDefault(); + event.stopPropagation(); + if (!this.createButton.disabled) { + this.createButton.doCommand(); + } + } + }); + + // Bound on the root so Esc works regardless of which child has focus + // (name input, icon picker trigger, profile button, primary button). + // Open popups consume Esc before it reaches us, so the emoji/profile + // pickers still close as expected. + this.addEventListener("keydown", event => { + if (event.key === "Escape") { + event.preventDefault(); + event.stopPropagation(); + this.cancelButton.doCommand(); + } + }); + this.inputIcon.addEventListener("command", this.onIconCommand.bind(this)); this.profilesPopup = this.querySelector(