mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Accessibility: Use AccessibilityRole::ignored for UI elements that should not be accessible to screen readers but have accessible children
This commit is contained in:
parent
baa1bbafdf
commit
8d6ba3b54e
8 changed files with 34 additions and 6 deletions
|
|
@ -3163,6 +3163,11 @@ std::unique_ptr<AccessibilityHandler> Component::createAccessibilityHandler()
|
|||
return std::make_unique<AccessibilityHandler> (*this, AccessibilityRole::unspecified);
|
||||
}
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> Component::createIgnoredAccessibilityHandler (Component& comp)
|
||||
{
|
||||
return std::make_unique<AccessibilityHandler> (comp, AccessibilityRole::ignored);
|
||||
}
|
||||
|
||||
void Component::invalidateAccessibilityHandler()
|
||||
{
|
||||
accessibilityHandler = nullptr;
|
||||
|
|
|
|||
|
|
@ -2597,6 +2597,8 @@ protected:
|
|||
//==============================================================================
|
||||
/** @internal */
|
||||
virtual ComponentPeer* createNewPeer (int styleFlags, void* nativeWindowToAttachTo);
|
||||
/** @internal */
|
||||
static std::unique_ptr<AccessibilityHandler> createIgnoredAccessibilityHandler (Component&);
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,6 @@ public:
|
|||
{
|
||||
ProxyComponent (Component& c)
|
||||
{
|
||||
setAccessible (false);
|
||||
setWantsKeyboardFocus (false);
|
||||
setBounds (c.getBounds());
|
||||
setTransform (c.getTransform());
|
||||
|
|
@ -180,6 +179,11 @@ public:
|
|||
(float) getHeight() / (float) jmax (1, image.getHeight())), false);
|
||||
}
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
|
||||
{
|
||||
return createIgnoredAccessibilityHandler (*this);
|
||||
}
|
||||
|
||||
private:
|
||||
Image image;
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ Viewport::Viewport (const String& name) : Component (name)
|
|||
// content holder is used to clip the contents so they don't overlap the scrollbars
|
||||
addAndMakeVisible (contentHolder);
|
||||
contentHolder.setInterceptsMouseClicks (false, true);
|
||||
contentHolder.setAccessible (false);
|
||||
|
||||
scrollBarThickness = getLookAndFeel().getDefaultScrollbarWidth();
|
||||
|
||||
|
|
|
|||
|
|
@ -292,11 +292,9 @@ public:
|
|||
ListViewport (ListBox& lb) : owner (lb)
|
||||
{
|
||||
setWantsKeyboardFocus (false);
|
||||
setAccessible (false);
|
||||
|
||||
auto content = std::make_unique<Component>();
|
||||
content->setWantsKeyboardFocus (false);
|
||||
content->setAccessible (false);
|
||||
|
||||
setViewedComponent (content.release());
|
||||
}
|
||||
|
|
@ -466,6 +464,11 @@ public:
|
|||
return Viewport::keyPressed (key);
|
||||
}
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
|
||||
{
|
||||
return createIgnoredAccessibilityHandler (*this);
|
||||
}
|
||||
|
||||
private:
|
||||
void timerCallback() override
|
||||
{
|
||||
|
|
|
|||
|
|
@ -244,7 +244,6 @@ class TreeView::ContentComponent : public Component,
|
|||
public:
|
||||
ContentComponent (TreeView& tree) : owner (tree)
|
||||
{
|
||||
setAccessible (false);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -268,6 +267,11 @@ public:
|
|||
void mouseMove (const MouseEvent& e) override { mouseMoveInternal (e.getEventRelativeTo (this)); }
|
||||
void mouseExit (const MouseEvent& e) override { mouseExitInternal (e.getEventRelativeTo (this)); }
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
|
||||
{
|
||||
return createIgnoredAccessibilityHandler (*this);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
ItemComponent* getItemComponentAt (Point<int> p)
|
||||
{
|
||||
|
|
@ -670,6 +674,11 @@ public:
|
|||
return Viewport::keyPressed (key);
|
||||
}
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override
|
||||
{
|
||||
return createIgnoredAccessibilityHandler (*this);
|
||||
}
|
||||
|
||||
private:
|
||||
void timerCallback() override
|
||||
{
|
||||
|
|
@ -689,7 +698,6 @@ private:
|
|||
TreeView::TreeView (const String& name) : Component (name)
|
||||
{
|
||||
viewport = std::make_unique<TreeViewport>();
|
||||
viewport->setAccessible (false);
|
||||
addAndMakeVisible (viewport.get());
|
||||
viewport->setViewedComponent (new ContentComponent (*this));
|
||||
|
||||
|
|
|
|||
|
|
@ -158,6 +158,11 @@ float TooltipWindow::getDesktopScaleFactor() const
|
|||
return Component::getDesktopScaleFactor();
|
||||
}
|
||||
|
||||
std::unique_ptr<AccessibilityHandler> TooltipWindow::createAccessibilityHandler()
|
||||
{
|
||||
return createIgnoredAccessibilityHandler (*this);
|
||||
}
|
||||
|
||||
void TooltipWindow::timerCallback()
|
||||
{
|
||||
auto& desktop = Desktop::getInstance();
|
||||
|
|
|
|||
|
|
@ -131,6 +131,8 @@ public:
|
|||
//==============================================================================
|
||||
/** @internal */
|
||||
float getDesktopScaleFactor() const override;
|
||||
/** @internal */
|
||||
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue