Accessibility: private createAccessibilityHandler() causing an issue

Hi there. I’m implementing some accessibility in my app, and I’ve run into a small snag. I have some objects derived from JUCE objects (e.g. Button, Slider, Label) which should normally be accessible in the normal way, but which might sometimes need to have customised accessibility. I’d can’t make a new derived class just for this, because my app involves UI elements which are configured at runtime with a ValueTree.

I’d like to do something like this, but I can’t, because createAccessibilityHandler() is private in most of the default JUCE classes. Is there any way around this? If not, would you consider making the method public on these classes?

std::unique_ptr<juce::AccessibilityHandler> createAccessibilityHandler() override
{
    if (hasCustomAccessibility)
        return my::CustomAccessibilityHandler (accessibilityConfig);
    else
        return juce::Button::createAccessibilityHandler();
}

Thanks for the request, that’s been added here:

1 Like

@reuk Thank you!