diff --git a/framework/source/uielement/generictoolbarcontroller.cxx b/framework/source/uielement/generictoolbarcontroller.cxx index 0db12a966a23..f500adce46c8 100644 --- a/framework/source/uielement/generictoolbarcontroller.cxx +++ b/framework/source/uielement/generictoolbarcontroller.cxx @@ -149,6 +149,12 @@ void SAL_CALL GenericToolbarController::execute( sal_Int16 KeyModifier ) aCommandURL = m_aCommandURL; xDispatch = pIter->second; + + // tdf#138234 If this toolbar is a floating window then + // clicking on a button probably took the window focus. Let’s + // give it back to the toolbar’s frame. + if ( m_xFrame.is() && m_xFrame->getContainerWindow().is() ) + m_xFrame->getContainerWindow()->setFocus(); } css::util::URL aTargetURL;