[BUG] Keyboard focus for TabbedComponent

It took me very long to tackle down my faulty keyboard focus behaviour because the keyboard focus is so hard to debug – BUT I think I narrowed it down to a bug in TabbedComponent (here the code block from the cpp):

void TabbedComponent::changeCallback (int newCurrentTabIndex, const String& newTabName)
{
    auto* newPanelComp = getTabContentComponent (getCurrentTabIndex());

    if (newPanelComp != panelComponent)
    {
        if (panelComponent != nullptr)
        {
            panelComponent->setVisible (false);
            removeChildComponent (panelComponent);
        }

        panelComponent = newPanelComp;

        if (panelComponent != nullptr)
        {
            // do these ops as two stages instead of addAndMakeVisible() so that the
            // component has always got a parent when it gets the visibilityChanged() callback
            addChildComponent (panelComponent);
            panelComponent->sendLookAndFeelChange();
            panelComponent->setVisible (true);
            panelComponent->toFront (true); // TODO: HERE IT IS!!!!
        }

        repaint();
    }

    resized();
    currentTabChanged (newCurrentTabIndex, newTabName);
}

This callback is e.g. called when the ButtonBar wants to change the tab. I marked the line, where the TabbedComponent is stealing the keyboard focus no matter what. I think it would be more logical to only grab the focus, if the previous panelComponent (by hasKeyboardFocus(true /withChildren)) had the focus or the button bar itself maybe?
This normally probably not coming, because the tabs are normally switched by the user clicking on the button bar but in my case, the TabbedComponent was dynamically rebuilding itself through my callback engine (triggered from a completely different point in the program) and was therefore landing at that spot for adding the first tab. And that first tab made it through to that line without the user actually clicking anywhere near the TabbedComponent.

I hope this all makes some sort of sense. Is my proposed fix acceptable?

This just caught me again (my mistake, made a mistake maintaining my git submodule…). Would be great if one if the JUCE team could discuss this topic.