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

Mac: QCocoaAccessibleElement: When using QML Loader, all items created by the Loader show up as Role = Group in VoiceOver / AccInspector

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.12.2, 5.14.0 Alpha
    • 5.11.1
    • QPA
    • None
    • macOS with VoiceOver
    • macOS
    • 64e8e69d25e08ad81cdb5fb8c2897bc3c0283c9f (qt/qtbase/5.12)

    Description

      Repro steps: create an empty window that uses Loader {  } to load a few controls (NOTE: not QtQuick 2 controls because those don't use QQuickAccessibleAttached).

      Run the application with VoiceOver open. After the Loader completes, all controls loaded show up as "Group" instead of their actual role, like "StaticText" or "Button". This means users don't know which controls are interactable / focuseable.

      Root cause:

      QCocoaAccessibilityElement caches the initial Role value and never refreshes it afterwards.

      What happens:

      When a QQuickItem gets constructed, it receives the default accessibleRole = QAccessible::NoRole.

      Because the construction fires a QAccessibleEvent(ObjectCreated), a equivalent QCocoaAccessibleElement gets created right after construction.

      Later, the QQuickAccessibleAttached properties get created and the item's accessibleRole value gets updated, but VoiceOver will keep reading the cached value in QCocoaAccessibleElement.

      The constructor of QCocoaAccessibleElement looks like this:

      • (id)initWithId:(QAccessible::Id)anId
        {
        Q_ASSERT((int)anId < 0);
        self = [super init];
        if (self) { axid = anId; QAccessibleInterface *iface = QAccessible::accessibleInterface(axid); Q_ASSERT(iface); role = QCocoaAccessible::macRole(iface); }

      return self;
      }

      Note the caching of the role value.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            sorvig Morten Sørvig
            cosminp Cosmin Pancratov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes