Set accessibility role without creating custom AccessibilityHandler

Hi,

I’m using Accessibility Insights for Windows to check the accessibility of my JUCE app. I find the hierarchy of UI components is completely flat (i.e. there is no hierarchy) until I use setFocusContainerType(FocusContainerType::focusContainer) for any container/parent components. All good so far.

Next, I want to set these containers to AccessibilityRole::group, but I think it is unnecessarily verbose to do so. AFAIK, the only way to set the role is to create a custom AccessibilityHandler, the shortest form of which I can find is:

std::unique_ptr<juce::AccessibilityHandler> MyComponent::createAccessibilityHandler() {
	struct CustomAccessibilityHandler : public juce::AccessibilityHandler
	{
		explicit CustomAccessibilityHandler(juce::Component& component)
			: AccessibilityHandler(component, juce::AccessibilityRole::group) {}
	};

	return std::make_unique<CustomAccessibilityHandler>(*this);
}

I think there should be a simple function Component::setAccessibilityRole(AccessibilityRole) to do this in the constructor. This could also mean there is no need for createIgnoredAccessibilityHandler().

I’m happy to whip up a PR for this myself, I just wanted to check I’m not being stupid first! Any thoughts?