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())
|
if (handler->getComponent().isOnDesktop())
|
||||||
return static_cast<id> (handler->getComponent().getWindowHandle());
|
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))
|
if (UIAccessibilityElement* container = getContainer (self))
|
||||||
return container;
|
return container;
|
||||||
|
|
|
||||||
|
|
@ -56,19 +56,31 @@ static NSArray* getContainerAccessibilityElements (AccessibilityHandler& handler
|
||||||
{
|
{
|
||||||
id accessibleElement = [&childHandler]
|
id accessibleElement = [&childHandler]
|
||||||
{
|
{
|
||||||
id native = static_cast<id> (childHandler->getNativeImplementation());
|
id nativeChild = static_cast<id> (childHandler->getNativeImplementation());
|
||||||
|
|
||||||
if (! childHandler->getChildren().empty())
|
if ( ! childHandler->getChildren().empty()
|
||||||
return [native accessibilityContainer];
|
|| AccessibilityHandler::getNativeChildForComponent (childHandler->getComponent()) != nullptr)
|
||||||
|
{
|
||||||
|
return [nativeChild accessibilityContainer];
|
||||||
|
}
|
||||||
|
|
||||||
return native;
|
return nativeChild;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
if (accessibleElement != nil)
|
if (accessibleElement != nil)
|
||||||
[accessibleChildren addObject: accessibleElement];
|
[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;
|
return accessibleChildren;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,8 @@ public:
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
/** @internal */
|
/** @internal */
|
||||||
void paint (Graphics&) override;
|
void paint (Graphics&) override;
|
||||||
|
/** @internal */
|
||||||
|
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,10 @@ private:
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
UIViewComponent::UIViewComponent() {}
|
UIViewComponent::UIViewComponent() {}
|
||||||
UIViewComponent::~UIViewComponent() {}
|
UIViewComponent::~UIViewComponent()
|
||||||
|
{
|
||||||
|
AccessibilityHandler::setNativeChildForComponent (*this, nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
void UIViewComponent::setView (void* view)
|
void UIViewComponent::setView (void* view)
|
||||||
{
|
{
|
||||||
|
|
@ -113,6 +116,8 @@ void UIViewComponent::setView (void* view)
|
||||||
|
|
||||||
if (view != nullptr)
|
if (view != nullptr)
|
||||||
pimpl.reset (new Pimpl ((UIView*) view, *this));
|
pimpl.reset (new Pimpl ((UIView*) view, *this));
|
||||||
|
|
||||||
|
AccessibilityHandler::setNativeChildForComponent (*this, getView());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,4 +134,9 @@ void UIViewComponent::resizeToFitView()
|
||||||
|
|
||||||
void UIViewComponent::paint (Graphics&) {}
|
void UIViewComponent::paint (Graphics&) {}
|
||||||
|
|
||||||
|
std::unique_ptr<AccessibilityHandler> UIViewComponent::createAccessibilityHandler()
|
||||||
|
{
|
||||||
|
return std::make_unique<AccessibilityHandler> (*this, AccessibilityRole::group);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace juce
|
} // namespace juce
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue