authorgravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-02 19:16:24-07:00
committergravatar for git@paperclover.netclover caruso <git@paperclover.net> 2026-10-02 20:22:32-07:00
logd8e439ce5e7a3acbcc02653af384400b9a5052de
treefecfb35c8e659d083eac6d6a4111e623b259778f
parent7e428759e27de7e50a06ca5afadfbfe0f76c42f0
signature Signed by SSH key SHA256:52mNGHRsVFBDED9IAX5pe+LRWUefqTbxEReunq21QvU

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

1 files changed, 8 insertions(+), 9 deletions(-)

crates/snowbound/src/share.rs+8-9
...@@ -260,13 +260,11 @@ impl State {...@@ -260,13 +260,11 @@ impl State {
260 let starting = self.peers.starting.get(&location).cloned();260 let starting = self.peers.starting.get(&location).cloned();
261 let ui = &mut self.ui;261 let ui = &mut self.ui;
262 let theme = ui.theme.clone();262 let theme = ui.theme.clone();
263 let fields: &[Id] = if host.is_none() && dialog.protect {263 // Enter takes the dialog's default, Start Sharing or else Done, wherever the focus is
264 &[password_field()]264 // but on another button.
265 } else {
266 &[]
267 };
268 let entered =265 let entered =
269 ui::popup::navigation(ui, fields, &[NamedKey::Enter]).contains(&NamedKey::Enter);266 ui::popup::navigation(ui, &[share_id(), password_field()], &[NamedKey::Enter])
267 .contains(&NamedKey::Enter);
270 frame(ui, share_id(), "Live Share");268 frame(ui, share_id(), "Live Share");
271 text(ui, "notebook", &dialog.library.name, true);269 text(ui, "notebook", &dialog.library.name, true);
272 let (mut start, mut stop, mut copy) = (false, false, None);270 let (mut start, mut stop, mut copy) = (false, false, None);
...@@ -384,7 +382,8 @@ impl State {...@@ -384,7 +382,8 @@ impl State {
384 start = ui::button(ui, "start", "Start Sharing").clicked || entered;382 start = ui::button(ui, "start", "Start Sharing").clicked || entered;
385 }383 }
386 }384 }
387 let done = ui::button(ui, "done", "Done").clicked;385 let offered = host.is_none() && !matches!(starting, Some(None));
386 let done = ui::button(ui, "done", "Done").clicked || entered && !offered;
388 ui.close();387 ui.close();
389 ui.close();388 ui.close();
390 if let Some(code) = copy {389 if let Some(code) = copy {
...@@ -443,9 +442,9 @@ impl State {...@@ -443,9 +442,9 @@ impl State {
443 }442 }
444 }443 }
445 let ui = &mut self.ui;444 let ui = &mut self.ui;
445 let owners = [join_id(), code_field(), join_password()];
446 let entered =446 let entered =
447 ui::popup::navigation(ui, &[code_field(), join_password()], &[NamedKey::Enter])447 ui::popup::navigation(ui, &owners, &[NamedKey::Enter]).contains(&NamedKey::Enter);
448 .contains(&NamedKey::Enter);
449 frame(ui, join_id(), "Open Shared Notebook");448 frame(ui, join_id(), "Open Shared Notebook");
450 text(ui, "what", "Enter the code from the person sharing.", false);449 text(ui, "what", "Enter the code from the person sharing.", false);
451 labelled(ui, "Code:", |ui| {450 labelled(ui, "Code:", |ui| {