Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-140719

Wrong Windows UI Automation events send when new window/dialog is opened

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.7.3
    • None
    • Windows

      On Windows, when a Qt app opens a second window/dialog then Qt sends a Window_WindowOpened and an AutomationFocusChanged UI Automation event (instead of a Window_WindowClosed) event for the old window. This confuses accessibility tools. In particular, NVDA reads the text of the new window twice and in between it reads the old focus widget in the old window.

      You should be able to reproduce this with any Qt app that opens a second window/dialog and with any accessibility tool which logs UIA events. I have patched Qt to log all calls of QAccessible::updateAccessibility and to log all UIA events that are sent by Qt.

      The cause of the problem is the following:

      QGuiApplicationPrivate::processFocusWindowEvent is called when a new dialog is opened (or when the active window is changed by the user) (at least on Windows). This function sends FocusOut and FocusIn events to the QWindows before calling notifyActiveWindowChange which makes the new window the active window. Therefore, on Windows, the accessible state change event did send a Window_WindowOpened and an AutomationFocusChanged (instead of a Window_WindowClosed) event for the old window.

      The relevant code didn't change in Qt dev so that I'm pretty sure the problem still exists in the latest Qt.

      I have patched Qt to fix this problem for Gpg4win. I'll submit this patch to codereview.qt-project.org.

        For Gerrit Dashboard: QTBUG-140719
        # Subject Branch Project Status CR V

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            ikloecker Ingo Klöcker
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: