no-bug: Submit workspace creation form on Enter and cancel on Escape (gh-13549)

Co-authored-by: Zander Otavka <AlexanderOtavka@users.noreply.github.com>
Co-authored-by: mr. m <91018726+mr-cheffy@users.noreply.github.com>
This commit is contained in:
Zander Otavka
2026-05-04 01:21:43 -07:00
committed by GitHub
parent aa463e2cb0
commit b6624612cd
2 changed files with 23 additions and 0 deletions

View File

@@ -83,6 +83,7 @@
& label {
max-width: 4rem;
margin-left: 8px;
color: white;
}
& image {

View File

@@ -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(