From 6d82bee9ad7b4b93c15b2e2af968e38046b8f56a Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Mon, 8 Dec 2025 23:21:12 +0000
Subject: [PATCH] Add Activating event propagation to SuperView
Co-authored-by: tig <585482+tig@users.noreply.github.com>
---
Terminal.Gui/ViewBase/View.Command.cs | 23 +++++++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/Terminal.Gui/ViewBase/View.Command.cs b/Terminal.Gui/ViewBase/View.Command.cs
index 0ab3578a4..1e57c8ae3 100644
--- a/Terminal.Gui/ViewBase/View.Command.cs
+++ b/Terminal.Gui/ViewBase/View.Command.cs
@@ -256,8 +256,16 @@ public partial class View // Command APIs
/// event. The default handler calls this method.
///
///
- /// The event should be raised after the state of the View has been changed and before see
- /// .
+ ///
+ /// The event should be raised after the state of the View has been changed and before see
+ /// .
+ ///
+ ///
+ /// If the event is not handled and the is not null, the event will be propagated
+ /// to the 's method, allowing hierarchical components
+ /// (e.g. ) to handle activation events from subviews. Derived classes can override
+ /// to implement custom propagation handling.
+ ///
///
///
/// if no event was raised; input processing should continue.
@@ -280,6 +288,17 @@ public partial class View // Command APIs
// If the event is not canceled by the virtual method, raise the event to notify any external subscribers.
Activating?.Invoke (this, args);
+ // If the event was not handled and there's a SuperView, propagate the event up the hierarchy.
+ // This allows hierarchical components like MenuBar to handle activation events from subviews.
+ if (!args.Handled && SuperView is { })
+ {
+ bool? superResult = SuperView.RaiseActivating (ctx);
+ if (superResult is true)
+ {
+ return true;
+ }
+ }
+
return Activating is null ? null : args.Handled;
}