vcl/source/control/edit.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit b2b43e83ccc41c37bad32a4dcf07ca86bf2f8a15
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Thu Sep 7 15:42:57 2023 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Mon Sep 18 17:04:17 2023 +0200

    a11y: Call base class impl at beginning of Edit::GetFocus
    
    Call the base class implementation `Control::GetFocus()`
    (which currently is just `Window::GetFocus`) before doing
    anything else, not at the end. This ensures that
    a focused event is sent to the a11y layer before e.g.
    adapting text selection. Assistive tooling
    handles the currently focused object with
    special interest (and announces events on that
    object much more likely than for any other objects).
    
    This e.g. makes Orca announce the labels for the
    spinboxes (like "Width", "Height", "Left", "Right")
    in Writer's "Format" -> "Page Style" dialog -> "Page"
    page when using the qt6 VCL plugin.
    
    Previously, only the current value
    of the spinboxes was announced without the label
    when moving focus into one of them
    using the Tab key.
    
    The following 2 Orca commits [1] [2] in the
    LibreOffice-specific Orca code look related:
    
        commit c4c5d11656ec7221e4aa4b980e51c010dcc62674
        Author: Joanmarie Diggs <jdi...@igalia.com>
        Date:   Mon Aug 7 13:53:41 2017 -0400
    
            Work around event-ordering issue in LibreOffice
    
        commit 38b995d9bacc55bb455c4464b01c82b885ed5549
        Author: Joanmarie Diggs <jdi...@igalia.com>
        Date:   Fri Feb 15 09:40:07 2019 -0500
    
            Don't present locusOfFocus changes due to text-selection-changed 
events
    
    (The first one makes the object sending a
    text-selection-changed event the focus object in Orca,
    the second one then causes this implicit focus object
    to no longer be announced. And when LO itself sends
    the focused event for the object, the object is already
    considered as the focus object, i.e. not announced
    either because the assumption is that the focus hasn't
    changed.)
    
    If the new event order causes any issues elsewhere because
    other places depend on the previous order, that will have to
    be looked into individually, s.a. the discussion in the
    Gerrit change for some thoughts on that [3].
    
    [1] 
https://gitlab.gnome.org/GNOME/orca/-/commit/c4c5d11656ec7221e4aa4b980e51c010dcc62674
    [2] 
https://gitlab.gnome.org/GNOME/orca/-/commit/38b995d9bacc55bb455c4464b01c82b885ed5549
    [3] https://gerrit.libreoffice.org/c/core/+/156679
    
    Change-Id: Ib0188fe206a49c9052ec9694bafd451586ff0b9e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156679
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 92c03118727c..0e75dc36b91c 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -1839,6 +1839,8 @@ void Edit::ImplInvalidateOutermostBorder( vcl::Window* 
pWin )
 
 void Edit::GetFocus()
 {
+    Control::GetFocus();
+
     if ( mpSubEdit )
         mpSubEdit->ImplGrabFocus( GetGetFocusFlags() );
     else if ( !mbActivePopup )
@@ -1882,8 +1884,6 @@ void Edit::GetFocus()
 
         SetInputContext( InputContext( GetFont(), !IsReadOnly() ? 
InputContextFlags::Text|InputContextFlags::ExtText : InputContextFlags::NONE ) 
);
     }
-
-    Control::GetFocus();
 }
 
 void Edit::LoseFocus()

Reply via email to