1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-11 23:54:18 +00:00

Accessibility: Stop AccessibilityContainers from also being instances of AccessibilityElement

This commit is contained in:
reuk 2022-06-29 19:46:25 +01:00
parent 707767fa4c
commit 12fdf6bad8
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C
2 changed files with 9 additions and 8 deletions

View file

@ -58,7 +58,7 @@ static NSArray* getContainerAccessibilityElements (AccessibilityHandler& handler
{
id native = (id) childHandler->getNativeImplementation();
if (childHandler->getChildren().size() > 0)
if (! childHandler->getChildren().empty())
return [native accessibilityContainer];
return native;
@ -87,7 +87,7 @@ public:
private:
//==============================================================================
class AccessibilityContainer : public ObjCClass<UIAccessibilityElement>
class AccessibilityContainer : public ObjCClass<NSObject>
{
public:
AccessibilityContainer()
@ -249,17 +249,19 @@ private:
if (handler->getComponent().isOnDesktop())
return (id) handler->getComponent().getWindowHandle();
if (handler->getChildren().size() > 0)
if (! handler->getChildren().empty())
{
if (UIAccessibilityElement* container = getContainer (self))
return container;
static AccessibilityContainer cls;
id windowHandle = (id) handler->getComponent().getWindowHandle();
UIAccessibilityElement* container = [cls.createInstance() initWithAccessibilityContainer: windowHandle];
auto* parentWithChildren = handler->getParent();
[container retain];
while (parentWithChildren != nullptr && parentWithChildren->getChildren().empty())
parentWithChildren = parentWithChildren->getParent();
id container = cls.createInstance();
object_setInstanceVariable (container, "handler", handler);
object_setInstanceVariable (self, "container", container);

View file

@ -107,8 +107,7 @@ protected:
static BOOL getIsAccessibilityElement (id self, SEL)
{
if (auto* handler = getHandler (self))
return ! handler->isIgnored()
&& handler->getRole() != AccessibilityRole::window;
return ! handler->isIgnored() && handler->getRole() != AccessibilityRole::window;
return NO;
}