Accessibility - Component::isAccessible()

Hi folks,

Just to note that I’ve realised our accessibility support had stopped working a while back.

This was down to the change if implementation of Component::isAcccessible in the following commit:

Accessibility: Disable accessibility of child components when calling `Component::setAccessible (false);`
Author:
ed <eddavies95@gmail.com>
Date:
1 September 2021 at 15:21:38 BST
Commit Date:
2 September 2021 at 08:35:14 BST

We have (for example) a toolbar background that isn’t accessible, but have a button on top of that that is accessible. The change to isAccessible stopped prevented the button from being accessible.

The solution for me, was to change the implementation of isAccessible

bool Component::isAccessible() const noexcept
{
  return (! flags.accessibilityIgnoredFlag);
  //  return (! flags.accessibilityIgnoredFlag
  //          && (parentComponent == nullptr || parentComponent->isAccessible()));
}

So: I have (say) a toolbar background that I don’t want to be accessible, but want a button on top of that that is accessible, how can I achieve that without my above change?

I’m hope some bright spark out there will explain what I’m doing wrong! :slight_smile:

Best wishes,

Pete

The proper solution for this is to set the parent’s accessibility role to ignored. There’s a nice little utility function to do that:

    std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
    {
        return createIgnoredAccessibilityHandler (*this);
    }
1 Like

Thank you very much!!

Pete

1 Like