From 080793763bdbff2d3bd1a0a113132056ec1c163f Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 23 Nov 2026 07:12:42 -0500 Subject: [PATCH 1/2] prod merge: form fields close on Esc, Enter and picks again, and Linux autoscroll keeps production's feel The field editor no longer hands focus back to the field's part when its session ends (TextEditor::returns_focus(false), fw sync), which reopened the field. The page view opts into MiddleAutoscrollFeel::Reader (production's speed, a short hold latches, a canvas blur ends it). The unsaved question is the framework's alert dialog, so asks_to_save looks it up by that role; full screen hands the keys to the page view, so the Esc test reads the closed field from the session. DropVeil::show is show_with_files. Needs fw sync d132f0101, f2e83cd92 and cfd3adbe6 (pdf-port/sync-forms). --- crates/ui-egui/src/app/prefs.rs | 3 +++ crates/ui-egui/src/chrome.rs | 2 +- crates/ui-egui/src/tools/forms_ui/editor.rs | 5 ++++- crates/ui-egui/src/workflows/combine_ui/view.rs | 2 +- crates/ui-egui/tests/it/forms.rs | 4 ++-- crates/ui-egui/tests/it/view.rs | 4 +++- 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/app/prefs.rs b/crates/ui-egui/src/app/prefs.rs index 076676c3b4..de77056c00 100644 --- a/crates/ui-egui/src/app/prefs.rs +++ b/crates/ui-egui/src/app/prefs.rs @@ -54,6 +54,9 @@ impl PdfCraftApp { if cfg!(target_os = "linux") { options.middle_button = craft::behavior::MiddleButton::AutoScroll; } + // Production's autoscroll: the speed grows with the pointer's whole distance from the mark, a release inside a + // short hold keeps it running, and it ends when the page view loses the keys. + options.middle_autoscroll = craft::ui::canvas::MiddleAutoscrollFeel::Reader; let eased = !self.animation_effects.reduced(None); options.animated_zoom = eased; options.eased_wheel = eased; diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 741e5b207f..0666e2a75c 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -61,7 +61,7 @@ fn window_body(app: &mut PdfCraftApp, ui: &mut egui::Ui) { }); let veil = DropVeil::new(tl!("Drop to open the files")); let veil = if organize { veil.positional() } else { veil }; - let _ = veil.show(ui, |ui, files| { + let _ = veil.show_with_files(ui, |ui, files| { if let Some(files) = files { dropped = Some(files.files.clone()); } diff --git a/crates/ui-egui/src/tools/forms_ui/editor.rs b/crates/ui-egui/src/tools/forms_ui/editor.rs index 70791cb177..36dd3c01ce 100644 --- a/crates/ui-egui/src/tools/forms_ui/editor.rs +++ b/crates/ui-egui/src/tools/forms_ui/editor.rs @@ -391,7 +391,10 @@ pub(crate) fn show( let editor = TextEditor::new(f.name.clone(), &mut host, Bind::bound(selection)) .id_salt((f.obj, widget)) .mode(if multiline { EditorMode::FieldLines } else { EditorMode::FieldLine }) - .esc_commits(false); + .esc_commits(false) + // The field's part handed the editor the focus: going back there when the session ends would open the + // field again, so an ended session leaves the focus as production does. + .returns_focus(false); let editor = if f.has(field_flags::PASSWORD) { editor.masked() } else { editor }; let out = ui.push_id((&f.name, f.obj, widget), |ui| editor.show_at(ui, rect)).inner; ended = out.ended; diff --git a/crates/ui-egui/src/workflows/combine_ui/view.rs b/crates/ui-egui/src/workflows/combine_ui/view.rs index 0622cca369..cee8262fbf 100644 --- a/crates/ui-egui/src/workflows/combine_ui/view.rs +++ b/crates/ui-egui/src/workflows/combine_ui/view.rs @@ -144,7 +144,7 @@ pub(crate) fn page(app: &mut PdfCraftApp, ui: &mut egui::Ui) { }); // The list; files dropped over the window join it. - DropVeil::new(tl!("Drop to add the files")).show(ui, |ui, files| { + DropVeil::new(tl!("Drop to add the files")).show_with_files(ui, |ui, files| { if let Some(files) = files { dropped = Some(files.files.clone()); } diff --git a/crates/ui-egui/tests/it/forms.rs b/crates/ui-egui/tests/it/forms.rs index fa70697b94..366e0ff835 100644 --- a/crates/ui-egui/tests/it/forms.rs +++ b/crates/ui-egui/tests/it/forms.rs @@ -65,9 +65,9 @@ fn card_count(h: &Harness<'static, PdfCraftApp>) -> usize { toast::cards(&h.ctx, &WindowKey::main()).len() } -/// Whether the "Save changes?" prompt is on screen. +/// Whether the "Save changes?" prompt is on screen: an alert dialog, the framework's role for the question. fn asks_to_save(h: &Harness<'static, PdfCraftApp>) -> bool { - h.query_by(|n| n.role() == egui::accesskit::Role::Dialog && n.label().is_some_and(|l| l.starts_with("Save changes to “"))).is_some() + h.query_by(|n| n.role() == egui::accesskit::Role::AlertDialog && n.label().is_some_and(|l| l.starts_with("Save changes to “"))).is_some() } /// The unsaved-changes question's Save answer in the platform's words (production's wording, on every platform). diff --git a/crates/ui-egui/tests/it/view.rs b/crates/ui-egui/tests/it/view.rs index a09164d580..3ea3f19b37 100644 --- a/crates/ui-egui/tests/it/view.rs +++ b/crates/ui-egui/tests/it/view.rs @@ -2561,7 +2561,9 @@ fn full_screen_esc_from_a_field_closes_the_field_first() { h.key_press(Key::Escape); h.run_steps(4); assert!(h.state().full_screen(), "the first Esc closes the field only"); - assert!(!h.ctx.egui_wants_keyboard_input(), "the field is closed"); + // Full screen hands the keyboard to the page view once nothing holds it, so the closed field is read from the + // session rather than from egui's keyboard claim. + assert!(h.state().views[n].session.forms.focus.is_none(), "the field is closed"); h.key_press(Key::Escape); h.run_steps(4); assert!(!h.state().full_screen(), "the second Esc leaves full screen"); From 8914e9bf9a851192a100fb3b270c42e5fb6465cd Mon Sep 17 00:00:00 2001 From: "Dylan M. Taylor" Date: Mon, 23 Nov 2026 07:14:26 -0500 Subject: [PATCH 2/2] =?UTF-8?q?prod=20merge:=20opt=20into=20PdfCraft's=20l?= =?UTF-8?q?ooks=20(DropdownArrow::Triangle,=20DocumentTabLook::Shrinking,?= =?UTF-8?q?=20DialogButtonLook::Quiet,=20PageInsets::Theme=20at=20the=20ro?= =?UTF-8?q?ot;=20alternate=5Frole(Alternative)=20on=20Save=20as=E2=80=A6,?= =?UTF-8?q?=20Keep=20editable=20and=20the=20script's=20No;=20StartScreen?= =?UTF-8?q?=20heading=5Fsections=20+=20pinned=5Ffirst;=20ToolbarDrawer=20g?= =?UTF-8?q?rouped=5Ftools=5Fdrag;=20PageView=20go=5Fto=5Fplace(GapAbove)?= =?UTF-8?q?=20+=20fill=5Fscreen;=20CommandState::hint=5Falone;=20the=20cho?= =?UTF-8?q?ice=20list=20names=20its=20list);=20DropVeil=20show=5Fwith=5Ffi?= =?UTF-8?q?les;=20a=20selected=20object's=20on-screen=20page=20becomes=20c?= =?UTF-8?q?urrent=20without=20a=20Go=20To?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- crates/ui-egui/src/app.rs | 7 +++++++ crates/ui-egui/src/canvas.rs | 16 +++++++++++++--- crates/ui-egui/src/chrome.rs | 2 +- crates/ui-egui/src/commands/catalog.rs | 3 ++- crates/ui-egui/src/dialogs/signature.rs | 2 ++ crates/ui-egui/src/editing/save.rs | 4 +++- crates/ui-egui/src/home.rs | 4 ++++ crates/ui-egui/src/hotbar.rs | 7 ++++++- crates/ui-egui/src/script_dialog.rs | 3 ++- crates/ui-egui/src/tools/forms_ui/choice_list.rs | 6 +++++- crates/ui-egui/src/workflows/combine_ui/view.rs | 2 +- 11 files changed, 46 insertions(+), 10 deletions(-) diff --git a/crates/ui-egui/src/app.rs b/crates/ui-egui/src/app.rs index 387f40d76b..bdb51f1dd6 100644 --- a/crates/ui-egui/src/app.rs +++ b/crates/ui-egui/src/app.rs @@ -547,6 +547,13 @@ impl PdfCraftApp { root.sizes = Arc::clone(sizes); // Every parameter dialog lays out as a document dialog: inline captions, shaded groups, buttons across the foot. root.values.set(craft::ui::patterns::form_dialogs::DialogLayout(craft::ui::patterns::form_dialogs::ParamLayout::Document)); + // PdfCraft's looks, opt-in over the framework's defaults: the filled dropdown triangle, shrinking document + // tabs with the modified dot, quiet (ghost) Cancel and Don't Save, and the theme's page insets. + root.values + .set(craft::ui::controls::disclosure::DropdownArrow::Triangle) + .set(craft::ui::tabs::DocumentTabLook::Shrinking) + .set(craft::ui::sections::DialogButtonLook::Quiet) + .set(craft::pages::ui::PageInsets::Theme); root.motion = self.animation_effects; // Today is the session's day, the one its date formats and Fill & Sign's Date tool use: the calendars ring it // and pick it. diff --git a/crates/ui-egui/src/canvas.rs b/crates/ui-egui/src/canvas.rs index 5b7cf3b6c4..eff7d08b73 100644 --- a/crates/ui-egui/src/canvas.rs +++ b/crates/ui-egui/src/canvas.rs @@ -10,7 +10,9 @@ use std::sync::Arc; use craft::behavior::{CanvasView, PointerButton, PressPhase, Selection}; use craft::host::queue::{JobQueue, QueueOptions}; -use craft::pages::ui::{PageBody, PageView, PageViewOutput, PageViewState, PlacedPage, TextMark, TextMarks, TextSelectState, TextSelection}; +use craft::pages::ui::{ + GoToPlace, PageBody, PageView, PageViewOutput, PageViewState, PlacedPage, TextMark, TextMarks, TextSelectState, TextSelection, +}; use craft::review::ui::annotate::AnnotateWords; use craft::ui::canvas::{ContextRequest, Momentary, NavigationOptions, PageBorder, PasteboardColor, ToolHost}; use craft::ui::contract::{Props as _, Show as _}; @@ -1722,8 +1724,8 @@ pub fn document_area_at(app: &mut PdfCraftApp, index: usize, rect: Rect, ui: &mu }); let veiled = page_overlays::veiled(view); // Shadows only with the preference on, and only between gaps: they would darken the page before when pages touch. - // Full screen filling the screen: the page alone on black, edge to edge (#576), so no shadow either. The framework's - // edge-to-edge spacing (PageView::fill_screen, L-314) is owed; until it lands the page keeps the view's margins. + // Full screen filling the screen: the page alone on black, edge to edge (#576, PageView::fill_screen), so no shadow + // either. let fill_screen = view.fills_screen(); let border = if view.view.page_gaps && app.show_page_edge_shadows && !fill_screen { PageBorder::DropShadow } else { PageBorder::None }; let keep = view.session.presenter.keep_pages(); @@ -1830,6 +1832,9 @@ pub fn document_area_at(app: &mut PdfCraftApp, index: usize, rect: Rect, ui: &mu .border(border) .pasteboard(surround) .keep(&keep) + // Production's Go To: the page gap above the page's top. + .go_to_place(GoToPlace::GapAbove) + .fill_screen(fill_screen) .show_at_with(ui, rect, &mut callbacks, page_before, page_body) }) .inner; @@ -1859,6 +1864,11 @@ pub fn document_area_at(app: &mut PdfCraftApp, index: usize, rect: Rect, ui: &mu } match view.session.pending_page.take() { Some((page, Some(rect))) => view.reveal_rect(page, rect, info), + // A page already on screen in a continuous view (an object selected on it, Set Page Boxes' page) becomes the + // current page where it stands: a Go To would scroll it to the gap above its top (GoToPlace::GapAbove). + Some((page, None)) if view.view.continuous && view.session.placed.iter().any(|placed| placed.page == page) => { + view.view.current = page; + } Some((page, None)) => view.go_to_page(page), None => {} } diff --git a/crates/ui-egui/src/chrome.rs b/crates/ui-egui/src/chrome.rs index 741e5b207f..0666e2a75c 100644 --- a/crates/ui-egui/src/chrome.rs +++ b/crates/ui-egui/src/chrome.rs @@ -61,7 +61,7 @@ fn window_body(app: &mut PdfCraftApp, ui: &mut egui::Ui) { }); let veil = DropVeil::new(tl!("Drop to open the files")); let veil = if organize { veil.positional() } else { veil }; - let _ = veil.show(ui, |ui, files| { + let _ = veil.show_with_files(ui, |ui, files| { if let Some(files) = files { dropped = Some(files.files.clone()); } diff --git a/crates/ui-egui/src/commands/catalog.rs b/crates/ui-egui/src/commands/catalog.rs index 978ccd79d7..74e9c0c300 100644 --- a/crates/ui-egui/src/commands/catalog.rs +++ b/crates/ui-egui/src/commands/catalog.rs @@ -145,7 +145,8 @@ pub(crate) fn command_input(app: &mut PdfCraftApp, ctx: &egui::Context) -> Comma fn state_of(app: &PdfCraftApp, ctx: &egui::Context, command: &CommandRef, gated: bool) -> CommandState { let enabled = enabled(app, ctx, command); - let mut state = CommandState::new().enabled(enabled); + // L-72: on a control whose label shows whole, the tooltip is the hint alone (with the chord), as production's. + let mut state = CommandState::new().enabled(enabled).hint_alone(true); if let Some(checked) = checked(app, command) { state = state.checked(checked); } diff --git a/crates/ui-egui/src/dialogs/signature.rs b/crates/ui-egui/src/dialogs/signature.rs index a53b3b8dd3..b58f22cd5f 100644 --- a/crates/ui-egui/src/dialogs/signature.rs +++ b/crates/ui-egui/src/dialogs/signature.rs @@ -64,6 +64,8 @@ pub(crate) fn ask_lock(app: &mut PdfCraftApp, pending: PendingLock) { .button(PromptChoice::Proceed, tl!("Lock and save").to_string()) .button(PromptChoice::Alternate, tl!("Keep editable").to_string()) .button(PromptChoice::Cancel, tl!("Cancel").to_string()) + // Production's order: Keep editable between Cancel and Lock and save. + .alternate_role(craft::ui::sections::DialogRole::Alternative) .dont_show_again() .tag(id) .instance("lock-signatures"); diff --git a/crates/ui-egui/src/editing/save.rs b/crates/ui-egui/src/editing/save.rs index 7b5fa49131..8881be9c57 100644 --- a/crates/ui-egui/src/editing/save.rs +++ b/crates/ui-egui/src/editing/save.rs @@ -188,7 +188,9 @@ impl PdfCraftApp { .title(tl!("Save over the changed file?").to_string()) .button(PromptChoice::Proceed, tl!("Save anyway").to_string()) .button(PromptChoice::Alternate, tl!("Save as…").to_string()) - .button(PromptChoice::Cancel, tl!("Cancel").to_string()); + .button(PromptChoice::Cancel, tl!("Cancel").to_string()) + // Production's order: Save as… between Cancel and Save anyway. + .alternate_role(craft::ui::sections::DialogRole::Alternative); let prompt = crate::dialogs::host::open(self, prompt); if let Some(pending) = self.pending_save.as_mut().filter(|p| p.key == key) { pending.prompt = Some(prompt); diff --git a/crates/ui-egui/src/home.rs b/crates/ui-egui/src/home.rs index 62180087ca..8a942f5145 100644 --- a/crates/ui-egui/src/home.rs +++ b/crates/ui-egui/src/home.rs @@ -148,6 +148,10 @@ pub fn show(app: &mut PdfCraftApp, ui: &mut egui::Ui) { let (mut view, mut sort) = (app.recent_view, app.recent_sort); let mut screen = StartScreen::new(craft::ui::contract::Bind::bound(&mut view), craft::ui::contract::Bind::bound(&mut sort), &files) .max_recent(app.recent_limit) + // Production's start screen: heading-strength section titles (Clear recent beside Recent) and the pinned + // folders above the recent files. + .heading_sections() + .pinned_first() .offers_new(false) // Open is in the title bar, as in production. .offers_open(false) diff --git a/crates/ui-egui/src/hotbar.rs b/crates/ui-egui/src/hotbar.rs index dda30fbf54..1edba44846 100644 --- a/crates/ui-egui/src/hotbar.rs +++ b/crates/ui-egui/src/hotbar.rs @@ -280,7 +280,12 @@ fn show_rail_over(app: &mut PdfCraftApp, ui: &mut egui::Ui, toolbar: &Tracked] = toolbar; - let drawer = ToolbarDrawer::new(output.response.rect, &groups, toolbar, output.dropped).kind(DrawerKind::Searchable).opened_by(opener).show(ui); + let drawer = ToolbarDrawer::new(output.response.rect, &groups, toolbar, output.dropped) + .kind(DrawerKind::Searchable) + .opened_by(opener) + // A tool that is on the toolbar only inside a group still drags from the drawer, as in production. + .grouped_tools_drag() + .show(ui); let defaults = slots_with(app, &[]); let mut edited: Option>> = None; for edit in &drawer.edits { diff --git a/crates/ui-egui/src/script_dialog.rs b/crates/ui-egui/src/script_dialog.rs index 1c4620e101..4ca9524cec 100644 --- a/crates/ui-egui/src/script_dialog.rs +++ b/crates/ui-egui/src/script_dialog.rs @@ -73,7 +73,8 @@ fn alert_prompt(run: DocId, document: &str, message: &Message) -> (StandardPromp } prompt = prompt.button(PromptChoice::Proceed, if yes_no { tl!("Yes").to_string() } else { tl!("OK").to_string() }); if yes_no { - prompt = prompt.button(PromptChoice::Alternate, tl!("No").to_string()); + // Production's order: No between Cancel and Yes. + prompt = prompt.button(PromptChoice::Alternate, tl!("No").to_string()).alternate_role(craft::ui::sections::DialogRole::Alternative); } // One script runs at a time and its prompt closes before the next opens, so the run names the instance. let prompt = prompt.button(PromptChoice::Cancel, tl!("Cancel").to_string()).instance(("script.prompt", run.0)); diff --git a/crates/ui-egui/src/tools/forms_ui/choice_list.rs b/crates/ui-egui/src/tools/forms_ui/choice_list.rs index ec58c260f2..e41189f286 100644 --- a/crates/ui-egui/src/tools/forms_ui/choice_list.rs +++ b/crates/ui-egui/src/tools/forms_ui/choice_list.rs @@ -2,7 +2,7 @@ use craft::behavior::{DisplayOrder, ItemSource}; // PLAN: assumed `craft::ui::contract::CollectionEvent` re-export of the collection event enum. -use craft::ui::contract::{Bind, CollectionEvent, LeadOnOpen, ShowCollection as _, ShowContainer as _, overlay::Anchor}; +use craft::ui::contract::{Bind, CollectionEvent, LeadOnOpen, Props as _, ShowCollection as _, ShowContainer as _, overlay::Anchor}; use craft::ui::fonts::FontRef; use craft::ui::list::{DocumentRows, List, ListRow}; use craft::ui::popover::{PopupList, PopupListKind}; @@ -52,14 +52,18 @@ pub(super) fn choice_list(ui: &mut egui::Ui, field: &FormField, rect: Rect, zoom }; let names: Vec<&str> = field.options.iter().map(|(_, shown)| shown.as_str()).collect(); let source = Names(&names); + // The popup names its list: the framework routes the field's list keys (arrows, End, Enter) to a named list only. + let list = ui.scope_id().with("pdfcraft.choice-list"); let shown = PopupList::new(tl!("Options"), Bind::bound(&mut *open)) .kind(PopupListKind::Document) .overlay(|overlay| { let dismiss = overlay.dismiss.focus_left(false); overlay.anchor(Anchor::Rect(rect)).dismiss(dismiss) }) + .list(list) .show(ui, |ui, _| { List::::options(tl!("Options")) + .id(list) .lead_on_open(LeadOnOpen::Selected) .document_rows(DocumentRows::new(FontRef::proportional(), size, align)) .show_items(ui, &source, &mut |key, _| ListRow::new(names.get(*key).copied().unwrap_or_default().to_owned()).option()) diff --git a/crates/ui-egui/src/workflows/combine_ui/view.rs b/crates/ui-egui/src/workflows/combine_ui/view.rs index 0622cca369..cee8262fbf 100644 --- a/crates/ui-egui/src/workflows/combine_ui/view.rs +++ b/crates/ui-egui/src/workflows/combine_ui/view.rs @@ -144,7 +144,7 @@ pub(crate) fn page(app: &mut PdfCraftApp, ui: &mut egui::Ui) { }); // The list; files dropped over the window join it. - DropVeil::new(tl!("Drop to add the files")).show(ui, |ui, files| { + DropVeil::new(tl!("Drop to add the files")).show_with_files(ui, |ui, files| { if let Some(files) = files { dropped = Some(files.files.clone()); }