Browse Source

Accessibility: Stop AccessibilityContainers from also being instances of AccessibilityElement

v7.0.9
reuk 3 years ago
parent
commit
12fdf6bad8
No known key found for this signature in database GPG Key ID: FCB43929F012EE5C
2 changed files with 9 additions and 8 deletions
  1. +8
    -6
      modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm
  2. +1
    -2
      modules/juce_gui_basics/native/accessibility/juce_mac_AccessibilitySharedCode.mm

+ 8
- 6
modules/juce_gui_basics/native/accessibility/juce_ios_Accessibility.mm View File

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


+ 1
- 2
modules/juce_gui_basics/native/accessibility/juce_mac_AccessibilitySharedCode.mm View File

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


Loading…
Cancel
Save