From f16d690a2f8c6ff1830a15794950c8564ae18a29 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 26 Mar 2014 10:14:45 +0100 Subject: Accessibility Mac: Fix handling of top level widget MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jan Arve Sæther --- .../platforms/cocoa/qcocoaaccessibilityelement.mm | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm') 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 -- cgit v1.2.3