1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-21 01:24:21 +00:00

MacOS: Accessibility: Fix returning ignored native element in accessibilityChildren

This fixes a bug, where VoiceOver would interact with the InnerNSView in
the AudioPluginHost. Instead the focus now jumps from the minimise
button directly to the plugin's first accessible element.

On MacOS the rule is: when returning accessibilityChildren an ignored
child must be replaced with its own children. When returning the
accessibilityParent, an ignored element must be replaced with its own
parent.
This commit is contained in:
attila 2023-10-19 18:17:47 +02:00
parent 9654f4a7e9
commit 387eea5f51

View file

@ -792,8 +792,18 @@ private:
for (auto* childHandler : children)
[accessibleChildren addObject: static_cast<id> (childHandler->getNativeImplementation())];
if (auto* nativeChild = AccessibilityHandler::getNativeChildForComponent (handler->getComponent()))
[accessibleChildren addObject: static_cast<id> (nativeChild)];
if (id nativeChild = static_cast<id> (AccessibilityHandler::getNativeChildForComponent (handler->getComponent())))
{
// Having both native and non-native children would require implementing an
// ordering. However, this situation doesn't occur with any of our current
// use-cases.
jassert ([accessibleChildren count] == 0);
if ([nativeChild isAccessibilityElement])
[accessibleChildren addObject:nativeChild];
else if (auto* childrenOfChild = [nativeChild accessibilityChildren]; childrenOfChild != nil)
[accessibleChildren addObjectsFromArray:(NSArray* _Nonnull) childrenOfChild];
}
return accessibleChildren;
}