Skip to content

Commit

Permalink
Fix regression preventing VoiceOver following the keyboard focus
Browse files Browse the repository at this point in the history
In fafdb17 a potential nullptr deref
was fixed, but it changed the hierarchy of accessible objects.
The new hierarchy would prefer to send a parent object that represents
the application, but macOS needs the window to be in the hierarchy for
VoiceOver to behave as expected.
Tweak it so that we give the window as parent again, not the app.

Change-Id: I5f7f59b07d0966c8bcf96968e4ed65eba9e05be6
Reviewed-by: Jan Arve Sæther <[email protected]>
  • Loading branch information
gladhorn committed Feb 7, 2017
1 parent e9686b3 commit ee34897
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/plugins/platforms/cocoa/qcocoaaccessibilityelement.mm
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,16 @@ - (id)parentElement {
if (!iface || !iface->isValid())
return nil;

// macOS expects that the hierarchy is:
// App -> Window -> Children
// We don't actually have the window reflected properly in QAccessibility.
// Check if the parent is the application and then instead return the native window.

if (QAccessibleInterface *parent = iface->parent()) {
QAccessible::Id parentId = QAccessible::uniqueId(parent);
return [QMacAccessibilityElement elementWithId: parentId];
if (parent->role() != QAccessible::Application) {
QAccessible::Id parentId = QAccessible::uniqueId(parent);
return [QMacAccessibilityElement elementWithId: parentId];
}
}

if (QWindow *window = iface->window()) {
Expand Down

0 comments on commit ee34897

Please sign in to comment.