From 0823a36952a6791a0e28e6e8eac4f35639ab3091 Mon Sep 17 00:00:00 2001 From: Emil Ernerfeldt Date: Mon, 16 Dec 2024 15:07:14 +0100 Subject: [PATCH] Fix: ui.new_child should now respect 'disabled' (#5483) * Closes https://github.com/emilk/egui/issues/5475 --- crates/egui/src/ui.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/crates/egui/src/ui.rs b/crates/egui/src/ui.rs index 786b93d53c4..6cc474e141b 100644 --- a/crates/egui/src/ui.rs +++ b/crates/egui/src/ui.rs @@ -301,7 +301,7 @@ impl Ui { min_rect: placer.min_rect(), max_rect: placer.max_rect(), }; - let child_ui = Ui { + let mut child_ui = Ui { id: stable_id, unique_id, next_auto_id_salt, @@ -316,6 +316,10 @@ impl Ui { min_rect_already_remembered: false, }; + if disabled { + child_ui.disable(); + } + // Register in the widget stack early, to ensure we are behind all widgets we contain: let start_rect = Rect::NOTHING; // This will be overwritten when `remember_min_rect` is called child_ui.ctx().create_widget(