From d8e439ce5e7a3acbcc02653af384400b9a5052de Mon Sep 17 00:00:00 2001 From: clover caruso Date: Fri, 2 Oct 2026 19:16:24 -0700 Subject: [PATCH] fix: Enter takes Live Share's default wherever the focus is, and Open Shared Notebook's too Enter started sharing only from the password field. It now starts sharing, or once sharing has started closes the dialog, from anywhere in it but another button, which Enter presses as before; Open Shared Notebook takes it from the dialog itself as well as its fields. Assisted-by: claude-opus-5.5 --- crates/snowbound/src/share.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/crates/snowbound/src/share.rs b/crates/snowbound/src/share.rs index 1a99f5a8aca811350f6db324e02ac0329d788719..2b5a7626166ef4eecd76dfe0a80a5f6422295100 100644 --- a/crates/snowbound/src/share.rs +++ b/crates/snowbound/src/share.rs @@ -260,13 +260,11 @@ impl State { let starting = self.peers.starting.get(&location).cloned(); let ui = &mut self.ui; let theme = ui.theme.clone(); - let fields: &[Id] = if host.is_none() && dialog.protect { - &[password_field()] - } else { - &[] - }; + // Enter takes the dialog's default, Start Sharing or else Done, wherever the focus is + // but on another button. let entered = - ui::popup::navigation(ui, fields, &[NamedKey::Enter]).contains(&NamedKey::Enter); + ui::popup::navigation(ui, &[share_id(), password_field()], &[NamedKey::Enter]) + .contains(&NamedKey::Enter); frame(ui, share_id(), "Live Share"); text(ui, "notebook", &dialog.library.name, true); let (mut start, mut stop, mut copy) = (false, false, None); @@ -384,7 +382,8 @@ impl State { start = ui::button(ui, "start", "Start Sharing").clicked || entered; } } - let done = ui::button(ui, "done", "Done").clicked; + let offered = host.is_none() && !matches!(starting, Some(None)); + let done = ui::button(ui, "done", "Done").clicked || entered && !offered; ui.close(); ui.close(); if let Some(code) = copy { @@ -443,9 +442,9 @@ impl State { } } let ui = &mut self.ui; + let owners = [join_id(), code_field(), join_password()]; let entered = - ui::popup::navigation(ui, &[code_field(), join_password()], &[NamedKey::Enter]) - .contains(&NamedKey::Enter); + ui::popup::navigation(ui, &owners, &[NamedKey::Enter]).contains(&NamedKey::Enter); frame(ui, join_id(), "Open Shared Notebook"); text(ui, "what", "Enter the code from the person sharing.", false); labelled(ui, "Code:", |ui| { -- 2.54.0