Global Dock Tracking, Overlay Context Resolution#1029
Merged
wieslawsoltes merged 6 commits intomasterfrom Feb 7, 2026
Merged
Conversation
This was referenced Feb 11, 2026
Closed
This was referenced Feb 18, 2026
This was referenced Feb 25, 2026
This was referenced Mar 4, 2026
This was referenced Mar 4, 2026
Closed
This was referenced Mar 16, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Summary: Global Dock Tracking, Overlay Context Resolution, Samples, and Test Coverage
Linked Issue
ActiveDockableChanged/FocusedDockableChanged#1023Goal
Implement proper global tracking events/state across multi-root/multi-window layouts, align behavior with expected focus/activation semantics, expose this in MVVM/ReactiveUI samples via status bar updates, improve overlay service targeting for busy/dialog positioning, and provide broad test coverage.
What Changed
1. Core Global Tracking Model and API
Introduced first-class global tracking state in
IFactoryand wired it throughFactoryBase:GlobalDockTrackingState(Dockable,RootDock,Window,HostWindow)DockTrackingChangeReasonGlobalDockTrackingChangedEventArgsIFactory.GlobalDockTrackingStateIFactory.CurrentDockableIFactory.CurrentRootDockIFactory.CurrentDockWindowIFactory.CurrentHostWindowIFactory.GlobalDockTrackingChanged2. Event Context Enrichment
Expanded focus/active event args to include window/root ownership context:
ActiveDockableChangedEventArgsnow includes:RootDock,Window,HostWindowFocusedDockableChangedEventArgsnow includes:RootDock,Window,HostWindow3. Factory Tracking Behavior (Expected Semantics)
Implemented and refined global tracking transitions in
FactoryBase:OnWindowActivatedOnDockableActivatedOnFocusedDockableChangedOnActiveDockableChangedOnWindowDeactivatedOnWindowClosedOnWindowRemovedOnDockableDeactivatedmoves to focused/active fallback when available.Important correctness guards (review-driven)
To prevent background roots from overriding global context:
OnActiveDockableChangedonly updates global state when source root matches tracked root (or when nothing tracked yet).OnFocusedDockableChangedsame guard as above.OnDockableActivatednow uses the same root ownership guard (critical fix from review).4. FactoryExtensions Behavior
Updated helper behavior to prefer global tracking first:
GetActiveRoot()usesCurrentRootDockbefore legacy scan.GetCurrentDocument()usesCurrentDockablefallback.CloseFocusedDockable()prefers globally tracked dockable.GetCurrentDockWindow()GetCurrentHostWindow()5. Overlay Services API Improvement
Improved overlay lookup API so overlays resolve by dockable context (window-aware) rather than only host screen fallback:
IHostOverlayServicesProvidernew overload:GetServices(IScreen screen, IDockable dockable)HostOverlayServicesProvidernow resolves via dockable/owner/root/window path before fallback.DockNavigationHelpers:GetOverlayServices(...)GetBusyService(...)GetDialogService(...)GetConfirmationService(...)RoutableDocumentBaseandRoutableToolBaseto use dockable-aware overlay resolution.6. Sample UX Updates (Status Bar)
Added global tracking status display in:
samples/DockMvvmSamplesamples/DockReactiveUISampleBoth now:
GlobalDockTrackingChanged7. Documentation
Added and updated docs to reflect the new model and behavior:
docfx/articles/dock-global-tracking.mddock-events.mddock-active-document.mddock-overlay-services-reference.mddock-api-scenarios.mdtoc.ymlTesting
Existing multi-variant factory tests updated
Extended factory tests in all model variants:
Dock.Model.Mvvm.UnitTestsDock.Model.ReactiveUI.UnitTestsDock.Model.Prism.UnitTestsDock.Model.ReactiveProperty.UnitTestsDock.Model.Avalonia.UnitTestsCoverage includes:
New exhaustive tracking matrix tests
Added dedicated test suite:
tests/Dock.Model.Mvvm.UnitTests/GlobalDockTrackingTests.csCovers all tracked transitions and reasons, including:
DockTrackingChangeReasonNew headless integration tests
Added:
tests/Dock.Avalonia.HeadlessTests/GlobalDockTrackingTests.csValidates runtime/managed-window behavior:
SetActiveDockableLeak regression fix after CI review
Addressed leak-test failures caused by global tracking retaining strong references during unresolved-root initialization paths:
GlobalDockTrackingStatenow stores weak references for tracked dockable/root/window.OnActiveDockableChangedOnFocusedDockableChangedOnDockableActivatednow require a resolved root (
ResolveRootDock(...) != null).ActiveDockableChanged_With_Unresolved_Root_Does_Not_Change_StateDockableActivated_With_Unresolved_Root_Does_Not_Change_Statein
tests/Dock.Model.Mvvm.UnitTests/GlobalDockTrackingTests.csValidation Run (latest)
dotnet test Dock.slnx --nologoCS8601,CS8603)dotnet test -c Release tests/Dock.Avalonia.LeakTests/Dock.Avalonia.LeakTests.csproj --nologo115passed,0failed,0skipped)Commit Breakdown (granular)
0997df491- Add global dock tracking state and guarded factory updatesc43f26347- Improve overlay service resolution using dockable context91285bc33- Document global tracking and surface it in samples3e1de0435- Add factory tests for global tracking across model variants183e72e1c- Add exhaustive global tracking unit and headless tests3dfc466ef- Fix global tracking retention causing leak-test regressionsNotes for Reviewers
IHostOverlayServicesProviderimplementations must implement the new overload.Fixes #1023