vcl/source/window/accessibility.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 97d3baf3f92c4ab3e5dbd5a9c585dd1a1ad2b3d5
Author:     Michael Weghorn <m.wegh...@posteo.de>
AuthorDate: Fri Aug 9 15:59:28 2024 +0200
Commit:     Michael Weghorn <m.wegh...@posteo.de>
CommitDate: Fri Aug 9 22:16:02 2024 +0200

    vcl a11y: Don't report parent window for top-levels
    
    For top-level `vcl::Window`s, don't report any accessible
    parent from the `vcl::Window` hierarchy. Even though e.g.
    a parent for a dialog may be set in the widget hierarchy,
    that shouldn't be reflected in the a11y hierarchy.
    As top-level windows are direct children of the application
    (on Linux) or the desktop (on Windows), reporting another
    window as the parent would be inconsistent.
    
    Reporting the dialog's parent as a11y parent is also
    inconsistent because the parent itself doesn't report
    the top-level dialog as a child either.
    
    With this commit in place, e.g. the "Save Document?"
    dialog in Writer no longer reports the main window
    ("'Untitled 1 — LibreOfficeDev Writer 25.2") as its
    parent when using the qt6 VCL plugin, but reports
    the app as its parent instead.
    
    This makes highlighting the correct area
    work when clicking on any of the children of
    the dialog in Accerciser's a11y tree of the LO
    hierarchy when run on Wayland, and also makes
    the "Inspect under Mouse" feature work to detect
    (and select) the object currently under the mouse
    pointer.
    
    Change-Id: I8c8789cd40598ed9370fa5d34e0429d024af14bd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171695
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.wegh...@posteo.de>

diff --git a/vcl/source/window/accessibility.cxx 
b/vcl/source/window/accessibility.cxx
index 2f3160a05b40..c61c9e7e9ab7 100644
--- a/vcl/source/window/accessibility.cxx
+++ b/vcl/source/window/accessibility.cxx
@@ -100,7 +100,7 @@ bool Window::ImplIsAccessibleCandidate() const
 
 vcl::Window* Window::GetAccessibleParentWindow() const
 {
-    if (!mpWindowImpl || IsNativeFrame())
+    if (!mpWindowImpl || IsNativeFrame() || IsTopWindow())
         return nullptr;
 
     vcl::Window* pParent = mpWindowImpl->mpParent;

Reply via email to