diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-03-26 10:14:45 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-27 14:37:16 +0100 |
commit | f16d690a2f8c6ff1830a15794950c8564ae18a29 (patch) | |
tree | 64be48ac43a332e2040f1ed8451efe4e605ba1e7 /src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | |
parent | 7aec099ca3cbc3f04562db027dc88f29e7ca28e4 (diff) |
Accessibility Mac: Fix handling of top level widget
This simplifies how we handle QNSView for accessibility purposes.
Instead of trying to half-merge the top level widget
(window->accessibleRoot) into the view, just have the view
always return it as child.
This makes the accessibility implementation for QNSView simpler
and makes applications that show a top level widget such as a button
possible. (We would return accessibility ignored for the button before).
As a side effect finding the active focus and hit-testing should be more reliable as
well.
Task-number: QTBUG-37794
Change-Id: Ib52037f88da8887a0bdc77204b0f3daddfe7709d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Reviewed-by: Jan Arve Sæther <jan-arve.saether@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm index bc98d002f0..0b674b8d2f 100644 --- a/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm +++ b/src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm @@ -417,7 +417,23 @@ } - (id)accessibilityFocusedUIElement { - return NSAccessibilityUnignoredAncestor(self); + QAccessibleInterface *iface = QAccessible::accessibleInterface(axid); + + if (!iface || !iface->isValid()) { + qWarning() << "FocusedUIElement for INVALID"; + return nil; + } + QAccessibleInterface *childInterface = iface->focusChild(); + if (childInterface) { + QAccessible::Id childAxid = QAccessible::uniqueId(childInterface); + // FIXME: parent could be wrong + QCocoaAccessibleElement *accessibleElement = [QCocoaAccessibleElement createElementWithId:childAxid parent:self]; + [accessibleElement autorelease]; + return accessibleElement; + } + + // no focus found + return nil; } @end |