From 78dd6993fd73cbe9a1a670152602a4dd1cfff704 Mon Sep 17 00:00:00 2001 From: aiongg Date: Wed, 11 Nov 2026 23:17:48 +0000 Subject: [PATCH] A control narrows its response to its own rect only when it claimed a label The comparison of the hit rect with the rect was true for a NaN rect, and narrowing it panicked. --- crates/ui-contract/src/contract/run.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/crates/ui-contract/src/contract/run.rs b/crates/ui-contract/src/contract/run.rs index 560025fb2..d2adb00ed 100644 --- a/crates/ui-contract/src/contract/run.rs +++ b/crates/ui-contract/src/contract/run.rs @@ -838,10 +838,11 @@ fn run_in_host(p: &mut Pass<'_, '_, '_>, ui: &mut Ui, host_at: Option, h let decls = parts.decls.parts(); let enabled = resolved.enabled && !inert; // A control that draws only its mark senses over its own label too: indicator, gap and label are one target. - let hit = if facts.labelled_after && !inert { scope::claim(&ctx).map_or(rect, |label| rect.union(label)) } else { rect }; + let label = if facts.labelled_after && !inert { scope::claim(&ctx) } else { None }; + let hit = label.map_or(rect, |label| rect.union(label)); let sensing::RootResult { mut response, parts: results, press, activation, activated_member, sense: root_sense } = sense_root(ui, member, RootSpec { id, rect: hit, own_sense: own, own: decls, enabled }, arena); - if hit != rect { + if label.is_some() { let shown = response.rect.intersect(rect); response.rect = Rect::from_min_max(shown.min, shown.max.max(shown.min)); }