summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2023-08-18 15:32:12 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2023-08-18 20:13:55 +0200
commit0008ff3597e9d89481d5fccb5cefa7f058400a43 (patch)
tree4832ab5ba5a9b881db339ddb91a6a566ddfa5310
parent5296b0ffe3ce031cab29d64d62e1bdc3fb2595fe (diff)
tdf#141101 a11y: Ensure focused event after showing popup content
If the `FloatWinPopupFlags::GrabFocus` flag is set, don't only pass it to `FloatingWindow::StartPopupMode`, but explicitly grab focus again after showing the docking window (client window of the floating window). At least proper handling for accessible focus/focused events depends on the window being visible at the point it receives focus. For winaccessibility, the a11y event listener only gets registered once the window gets shown (`VCLXAccessibleComponent::ProcessWindowChildEvent` forwards a `VclEventId::WindowShow` as `accessibility::AccessibleEventId::CHILD` event, which winaccessibility then processes and registers an event listener for the new child). This makes NVDA on Windows announce focus for the "Automatic" button in the color popup in Writer's character style dialog also when the popup shows for the first time. Change-Id: I2e4028eb4ec68a8b586cbd1a0dc5351d1453937e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/155843 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
-rw-r--r--vcl/source/window/dockmgr.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx
index ba9aa2aa9450..7cde1910fed3 100644
--- a/vcl/source/window/dockmgr.cxx
+++ b/vcl/source/window/dockmgr.cxx
@@ -823,6 +823,10 @@ void ImplDockingWindowWrapper::StartPopupMode( ToolBox *pParentToolBox, FloatWin
mpFloatWin->StartPopupMode( pParentToolBox, nFlags );
GetWindow()->Show();
+ // grab focus (again) after showing docking window, as e.g. a11y focus
+ // events require window to be visible first
+ if (nFlags & FloatWinPopupFlags::GrabFocus)
+ mpFloatWin->GrabFocus();
if( pParentToolBox->IsKeyEvent() )
{
@@ -841,6 +845,10 @@ void ImplDockingWindowWrapper::StartPopupMode( const tools::Rectangle& rRect, Fl
ImplPreparePopupMode();
mpFloatWin->StartPopupMode( rRect, nFlags );
GetWindow()->Show();
+ // grab focus (again) after showing docking window, as e.g. a11y focus
+ // events require window to be visible first
+ if (nFlags & FloatWinPopupFlags::GrabFocus)
+ mpFloatWin->GrabFocus();
}
IMPL_LINK_NOARG(ImplDockingWindowWrapper, PopupModeEnd, FloatingWindow*, void)