VectorCraft: An open-source, vector art tool written by scratch in pure Rust
Accessibility: Tab no longer stops on the Simplify and Smooth sliders' backdrop
dotCooCoo8bccbf2f356e
diff --git a/crates/ui-egui/src/dialogs/simplify_slider.rs b/crates/ui-egui/src/dialogs/simplify_slider.rsindex cf3866018..820ab9af9 100644--- a/crates/ui-egui/src/dialogs/simplify_slider.rs+++ b/crates/ui-egui/src/dialogs/simplify_slider.rs@@ -103,9 +103,10 @@ impl Strip {let b = bounds(app, &mut d);let pos = place(app, ctx, id, b);// A click anywhere else keeps the result, and the rest of the app doesn't take it.+ // Not focusable (`Sense::click()` is): Tab goes through the strip's controls, not the backdrop.let dim = modal::backdrop();let outside =- egui::Area::new(dim.id).order(dim.order).fixed_pos(Pos2::ZERO).show(ctx, |ui| ui.allocate_rect(ctx.content_rect(), Sense::click())).inner;+ egui::Area::new(dim.id).order(dim.order).fixed_pos(Pos2::ZERO).show(ctx, |ui| ui.allocate_rect(ctx.content_rect(), Sense::CLICK)).inner;let mut action: Option<Button> = None;egui::Area::new(id).order(Order::Foreground).fixed_pos(pos).show(ctx, |ui| {egui::Frame::NONEdiff --git a/crates/ui-egui/src/dialogs/tests_modal.rs b/crates/ui-egui/src/dialogs/tests_modal.rsindex c2b1daf06..db4008f6b 100644--- a/crates/ui-egui/src/dialogs/tests_modal.rs+++ b/crates/ui-egui/src/dialogs/tests_modal.rs@@ -575,6 +575,28 @@ fn smooth_slider_previews_auto_smooth_and_keeps_the_result() {assert_ne!(app.session.doc().unwrap().doc, before);}+/// Tab goes through the controls of the Simplify and Smooth sliders' strip and does not stop on the+/// backdrop that takes a click outside it.+#[test]+fn tab_skips_the_backdrop_of_the_simplify_and_smooth_sliders() {+ for (menu, kind) in [("object.path.simplify", simplify_slider::KIND), ("object.path.smooth", smooth_slider::KIND)] {+ let (ctx, mut app) = (ctx(), app_with_dense_path());+ crate::menus::invoke(&mut app, menu, json!({}));+ settle(&ctx, &mut app);+ let strip = rect_of(&ctx, egui::Id::unique(("dialog", kind)));+ let stops = crate::widgets::accessibility_tests::tab_stops(&ctx, 30, |events| {+ frame(&ctx, &mut app, events);+ });+ let inside = |s: &egui::Id| ctx.read_response(*s).is_some_and(|r| r.rect.is_positive() && strip.contains_rect(r.rect));+ assert!(stops.iter().any(inside), "{kind}: Tab reaches a control in the strip: {stops:?}");+ let backdrop: Vec<egui::Id> = ctx.viewport(|vp| {+ vp.prev_pass.widgets.layers().filter(|(l, _)| **l == modal::backdrop()).flat_map(|(_, w)| w.iter()).map(|w| w.id).collect()+ });+ assert!(!backdrop.is_empty(), "{kind}: the backdrop is drawn");+ assert!(!stops.iter().any(|id| backdrop.contains(id)), "{kind}: Tab stops on the backdrop: {stops:?}");+ }+}+/// More Options opens the Simplify dialog at the slider's tolerance. With "Open this dialog with/// these settings next time" ticked, OK makes the menu item open the dialog on its settings; with/// it unticked, the slider again.