Using MDI create two documents with names, a and b.
Click on each document and at activeDocumentChanged, getTheActive document and look at its name, it is the other documents name. At sometime later in the message loop it corrects itself.
The solution is to comment out the following in
// if (components != oldList)
Also MultiDocumentPanel::updateOrder should not rearrange the order of documents based on screen location. The order should remain the same as they are created. This is traditional Multiple Document Interface. You can test this with the DemoRunner.
and getActiveDocument should be
Component* MultiDocumentPanel::getActiveDocument() const noexcept
if (mode == FloatingWindows)
for (auto* child : getChildren())
if (auto* dw = dynamic_cast<MultiDocumentPanelWindow*> (child))
else if (tabComponent != nullptr)