Fix regression preventing VoiceOver following the keyboard focus
In fafdb171e0 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 <jan-arve.saether@qt.io>
bb10
parent
e9686b3718
commit
ee34897565
|
|
@ -235,9 +235,16 @@ static void convertLineOffset(QAccessibleTextInterface *text, int *line, int *of
|
|||
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()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue