mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
WebBrowserComponent: iOS: Add accessibility integration
This commit is contained in:
parent
f519af3b62
commit
18489bb7d7
4 changed files with 32 additions and 7 deletions
|
|
@ -277,7 +277,8 @@ private:
|
|||
if (handler->getComponent().isOnDesktop())
|
||||
return static_cast<id> (handler->getComponent().getWindowHandle());
|
||||
|
||||
if (! handler->getChildren().empty())
|
||||
if ( ! handler->getChildren().empty()
|
||||
|| AccessibilityHandler::getNativeChildForComponent (handler->getComponent()) != nullptr)
|
||||
{
|
||||
if (UIAccessibilityElement* container = getContainer (self))
|
||||
return container;
|
||||
|
|
|
|||
|
|
@ -56,19 +56,31 @@ static NSArray* getContainerAccessibilityElements (AccessibilityHandler& handler
|
|||
{
|
||||
id accessibleElement = [&childHandler]
|
||||
{
|
||||
id native = static_cast<id> (childHandler->getNativeImplementation());
|
||||
id nativeChild = static_cast<id> (childHandler->getNativeImplementation());
|
||||
|
||||
if (! childHandler->getChildren().empty())
|
||||
return [native accessibilityContainer];
|
||||
if ( ! childHandler->getChildren().empty()
|
||||
|| AccessibilityHandler::getNativeChildForComponent (childHandler->getComponent()) != nullptr)
|
||||
{
|
||||
return [nativeChild accessibilityContainer];
|
||||
}
|
||||
|
||||
return native;
|
||||
return nativeChild;
|
||||
}();
|
||||
|
||||
if (accessibleElement != nil)
|
||||
[accessibleChildren addObject: accessibleElement];
|
||||
}
|
||||
|
||||
[accessibleChildren addObject: static_cast<id> (handler.getNativeImplementation())];
|
||||
id nativeHandler = static_cast<id> (handler.getNativeImplementation());
|
||||
|
||||
if (auto* view = static_cast<UIView*> (AccessibilityHandler::getNativeChildForComponent (handler.getComponent())))
|
||||
{
|
||||
[static_cast<UIAccessibilityElement*> (view) setAccessibilityContainer: [nativeHandler accessibilityContainer]];
|
||||
|
||||
[accessibleChildren addObject: view];
|
||||
}
|
||||
|
||||
[accessibleChildren addObject: nativeHandler];
|
||||
|
||||
return accessibleChildren;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,6 +74,8 @@ public:
|
|||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics&) override;
|
||||
/** @internal */
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -103,7 +103,10 @@ private:
|
|||
|
||||
//==============================================================================
|
||||
UIViewComponent::UIViewComponent() {}
|
||||
UIViewComponent::~UIViewComponent() {}
|
||||
UIViewComponent::~UIViewComponent()
|
||||
{
|
||||
AccessibilityHandler::setNativeChildForComponent (*this, nullptr);
|
||||
}
|
||||
|
||||
void UIViewComponent::setView (void* view)
|
||||
{
|
||||
|
|
@ -113,6 +116,8 @@ void UIViewComponent::setView (void* view)
|
|||
|
||||
if (view != nullptr)
|
||||
pimpl.reset (new Pimpl ((UIView*) view, *this));
|
||||
|
||||
AccessibilityHandler::setNativeChildForComponent (*this, getView());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -129,4 +134,9 @@ void UIViewComponent::resizeToFitView()
|
|||
|
||||
void UIViewComponent::paint (Graphics&) {}
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> UIViewComponent::createAccessibilityHandler()
|
||||
{
|
||||
return std::make_unique<AccessibilityHandler> (*this, AccessibilityRole::group);
|
||||
}
|
||||
|
||||
} // namespace juce
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue