sc/source/ui/app/inputwin.cxx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-)
New commits: commit dd4f562cfdff35e99acc55f522f65f966fa7ee52 Author: Michael Weghorn <m.wegh...@posteo.de> AuthorDate: Mon Mar 13 09:23:02 2023 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Mon Mar 13 09:43:23 2023 +0000 sc a11y: tdf#139322 Don't steal focus from "Manage Names" dialog When opening the "Manage Names" dialog from the name box, move setting the dialog to after calling `ReleaseFocus_Impl`, since that one sets focus to the active view, and may thus steal the focus from the dialog otherwise. (Observed with gtk3 on Linux and on Windows, while focus was still in the dialog with kf5 or gen.) Setting the dialog afterwards ensures that the dialog gets focus when it opens, while still ensuring that the focus is no longer in the name box when the dialog closes again. Change-Id: I47f12d115a747ecda1c11c04282bd848eb398d9c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148775 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.wegh...@posteo.de> diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 0b5138ec419e..c5cc7a334262 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2553,6 +2553,7 @@ IMPL_LINK_NOARG(ScPosWnd, ModifyHdl, weld::ComboBox&, void) void ScPosWnd::DoEnter() { + bool bOpenManageNamesDialog = false; OUString aText = m_xWidget->get_active_text(); if ( !aText.isEmpty() ) { @@ -2615,11 +2616,8 @@ void ScPosWnd::DoEnter() } else if (eType == SC_MANAGE_NAMES) { - sal_uInt16 nId = ScNameDlgWrapper::GetChildWindowId(); - SfxViewFrame& rViewFrm = pViewSh->GetViewFrame(); - SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId ); - - SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); + // dialog is only set below after calling 'ReleaseFocus_Impl' to ensure it gets focus + bOpenManageNamesDialog = true; } else { @@ -2654,6 +2652,16 @@ void ScPosWnd::DoEnter() m_xWidget->set_entry_text(aPosStr); ReleaseFocus_Impl(); + + if (bOpenManageNamesDialog) + { + const sal_uInt16 nId = ScNameDlgWrapper::GetChildWindowId(); + ScTabViewShell* pViewSh = ScTabViewShell::GetActiveViewShell(); + assert(pViewSh); + SfxViewFrame& rViewFrm = pViewSh->GetViewFrame(); + SfxChildWindow* pWnd = rViewFrm.GetChildWindow( nId ); + SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); + } } IMPL_LINK_NOARG(ScPosWnd, ActivateHdl, weld::ComboBox&, bool)