office-gobmx/svx/source
Michael Weghorn 790730a9b7 a11y: Fix focused state for special char dialog item
As mentioned/worked around in Colomban's pending Gerrit change
to implement an a11y test for the "Special Characters" dialog [1],
the selected item in the character table was incorrectly still
reporting the "focused" state even if keyboard focus already
moved on from the parent widget to another one.

Fix this by checking the item is not only selected, but its
parent also has child focus.

Tested by running this pyatspi script after a sleep and using
the time before the script actually runs to interact with the
dialog to test the different scenarios for the focused state,
using the "!" character in the dialog):

    #!/usr/bin/python3
    import pyatspi
    def get_soffice_app():
        registry = pyatspi.registry.Registry()
        apps = list(registry.getDesktop(0))
        for app in apps:
            if app.name == 'soffice' or app.name == 'soffice.bin':
                return app
        print("soffice app not found")
        exit(1)
    def get_exclamation_mark_button(acc):
        i = 0
        while i < acc.get_child_count():
            child = acc.get_child_at_index(i)
            try:
                if child.name == '!':
                    return child
            except NotImplementedError:
                pass
            recursive_child = get_exclamation_mark_button(child)
            if recursive_child:
                return recursive_child
            i = i + 1
        return None
    app = get_soffice_app()
    obj = get_exclamation_mark_button(app)
    assert obj
    states = obj.get_state_set().get_states()
    print("states:")
    print(states)

[1] https://gerrit.libreoffice.org/c/core/+/142260/22/sw/qa/extras/accessibility/dialogs.cxx

Change-Id: I277890105e3ff84ed35100b7cd7dc2ff40510921
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/147660
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
2023-02-24 22:29:27 +00:00
..
accessibility a11y: Fix focused state for special char dialog item 2023-02-24 22:29:27 +00:00
core
customshapes related tdf#148966: rework sdr compatibility flags 2023-02-23 12:19:23 +00:00
diagram
dialog
engine3d
fmcomp osl::Mutex->std::mutex in FmXGridPeer 2023-02-21 10:39:38 +00:00
form create new OPropertyChangeListener2 and use it in FmFieldWin 2023-02-22 12:43:55 +00:00
gallery2
gengal
inc create new OPropertyChangeListener2 and use it in FmFieldWin 2023-02-22 12:43:55 +00:00
items Drop 'using namespace ::std' in dirs s* 2023-02-16 08:14:21 +00:00
mnuctrls
sdr MCGR: Adapted GradientLinear to make use of MCGR 2023-02-22 09:13:20 +00:00
sidebar
smarttags
stbctrls
styles
svdraw related tdf#148966: rework sdr compatibility flags 2023-02-23 12:19:23 +00:00
table
tbxctrls Resolves: tdf#148047 don't move focus if dropdown is active 2023-02-21 19:56:41 +00:00
theme
toolbars
uitest
unodialogs/textconversiondlgs
unodraw osl::Mutex->std::mutex in SvxShapeCollection 2023-02-21 08:57:30 +00:00
unogallery
xml
xoutdev