From 86ac6ac5f0f6d6cecb813298debadac7fc6cd79c Mon Sep 17 00:00:00 2001 From: aiongg Date: Tue, 24 Nov 2026 17:34:55 +0000 Subject: [PATCH] ui-panels trial: the claims-after-focus stop is a canvas control The window's document canvas holds its declared claims with nothing focused, so a `KeyUse::CANVAS` stop claimed Up in the frame focus arrived in. The trial is about a focused component's claims; its stop is a canvas control that marks no document (`with_chrome_key(false)`). --- crates/ui-panels/tests/it/focus/keys.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ui-panels/tests/it/focus/keys.rs b/crates/ui-panels/tests/it/focus/keys.rs index cea11f5da..10f86a96f 100644 --- a/crates/ui-panels/tests/it/focus/keys.rs +++ b/crates/ui-panels/tests/it/focus/keys.rs @@ -63,14 +63,15 @@ fn a_held_escape_cancels_once() { } /// Static claims hold in the frame after focus arrives; the chord is withheld from egui and read once through -/// `take_claimed`, and a claimed Escape is no `Cancel`. +/// `take_claimed`, and a claimed Escape is no `Cancel`. The stop is a canvas control, not the window's document canvas, +/// whose claims hold with nothing focused too. #[trial] fn claimed_chords_hold_after_focus_arrives_and_a_claimed_escape_is_no_cancel() { const CLAIMS: &[Chord] = &[Chord::plain(craft_keymap::Key::Up), Chord::plain(craft_keymap::Key::Escape)]; let mut frames = Frames::new(); let reads = RefCell::new((Vec::new(), 0, true)); let mut show = |ui: &mut egui::Ui| { - stop_with(ui, "canvas", KeyUse::CANVAS.with_claims(CLAIMS)); + stop_with(ui, "canvas", KeyUse::CANVAS.with_chrome_key(false).with_claims(CLAIMS)); let ctx = ui.ctx(); let mut reads = reads.borrow_mut(); reads.0.push((take_claimed(ctx, id("canvas"), CLAIMS[0]), take_claimed(ctx, id("canvas"), CLAIMS[1])));