Skip to content

GlobalDockTrackingChanged is not restored when switching from a floating window back to an already active tab in the main DocumentDock #1081

@SokurenkoED

Description

@SokurenkoED

We found what looks like a tracking pipeline issue when working with a floating document window and the main window.

Scenario:

  1. The main window contains a DocumentDock with multiple tabs.
  2. One document is moved into a floating window.
  3. Focus is currently on the floating document window.
  4. Then the user switches back to a document tab in the main DocumentDock, and this tab is the one that was already active in the main window before switching to the floating window.
  5. Visually, the tab in the main window becomes highlighted as active, but GlobalDockTrackingChanged does not fire.
  6. If the user then switches to another tab in the same DocumentDock, the event does fire.

Expected behavior:

  • when focus moves from the floating window back to the main window, tracking should be restored;
  • either WindowActivated, DockableActivated, or at least GlobalDockTrackingChanged should be raised for the current leaf document in the main DocumentDock.

Actual behavior:

  • on float -> main same tab, only DockableDeactivated events are observed;
  • there is no new WindowActivated / DockableActivated for the document in the main window;
  • GlobalDockTrackingChanged is not restored;
  • in addition, in some cases tracking points to container dockables such as DocumentDock / ProportionalDock instead of the leaf document.

Why this looks like a library issue

We added logging for raw factory events:

  • WindowActivated
  • WindowDeactivated
  • DockableActivated
  • DockableDeactivated
  • GlobalDockTrackingChanged

In the problematic scenario, the library itself does not raise an activated event for the document in the main window.

Example logs when switching from a floating window back to a tab in the main DocumentDock:

[DockEvent] Event=DockableDeactivated; Dockable=DockEditorDocumentViewModel: Title='Новый файл ТИГР.model', Id='df6ef874-cb2f-4a27-b192-08a36fcbbbad'; RootFocused=DockEditorDocumentViewModel: Title='Новый файл ТИГР.model', Id='df6ef874-cb2f-4a27-b192-08a36fcbbbad'; RootActive=DocumentDock: Title='IDocumentDock', Id=''; Window=DockWindow: Title='ModelKI', Id='IDockWindow'

[DockEvent] Event=DockableDeactivated; Dockable=DockEditorDocumentViewModel: Title='GRID.model', Id='c2dcd3e1-0a85-427c-a917-8ca5a312d679'; RootFocused=DockEditorDocumentViewModel: Title='GRID.model', Id='c2dcd3e1-0a85-427c-a917-8ca5a312d679'; RootActive=ProportionalDock: Title='', Id=''; Window=DockWindow: Title='ModelKI', Id='IDockWindow'
This shows:

  • deactivation is reported;
  • activation of the new current document is not reported;
  • RootActive may point to a container instead of a leaf document.

We also see another suspicious behavior in other transitions:

  1. WindowActivated first points correctly to the leaf document.
  2. Immediately after that, DockableActivated overwrites tracking with DocumentDock.

Example:

[DockTracking] Reason=WindowActivated; Previous=DockEditorDocumentViewModel: Title='CRCL2.model', Id='e8073cfc-950f-4c18-9384-e8918b7933af'; Current=DockEditorDocumentViewModel: Title='Новый файл ТИГР.model', Id='df6ef874-cb2f-4a27-b192-08a36fcbbbad'

[DockTracking] Reason=DockableActivated; Previous=DockEditorDocumentViewModel: Title='Новый файл ТИГР.model', Id='df6ef874-cb2f-4a27-b192-08a36fcbbbad'; Current=DocumentDock: Title='IDocumentDock', Id=''

This also looks incorrect: after activating a document, tracking degrades to a container dockable.

Questions

  1. Is this expected behavior, or is it a bug?
  2. Is GlobalDockTrackingChanged supposed to reliably point to the leaf dockable/document, rather than containers such as DocumentDock and ProportionalDock?
  3. Should float window -> main window same tab raise WindowActivated / DockableActivated for the current document in the main DocumentDock?

Environment

  • Dock.Model.ReactiveUI 11.3.11.21
  • corresponding Dock.Avalonia
  • Avalonia 11.3.11
  • .NET 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions