1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-19 01:04:20 +00:00

Accessibility: Disable accessibility for PopupMenu windows on the desktop when their parent window or target component have accessibility disabled

This commit is contained in:
ed 2021-09-15 09:32:50 +01:00
parent b65dc65bc2
commit d6fd33b38d
2 changed files with 18 additions and 3 deletions

View file

@ -2415,10 +2415,16 @@ public:
By default this is set to true.
@see getAccessibilityHandler
@see isAccessible, getAccessibilityHandler
*/
void setAccessible (bool shouldBeAccessible);
/** Returns true if this component and its children are visible to accessibility clients.
@see setAccessible
*/
bool isAccessible() const noexcept;
/** Returns the accessibility handler for this component, or nullptr if this component is not
accessible.
@ -2570,8 +2576,6 @@ private:
bool reallyContainsInternal (Point<float>, bool);
Component* getComponentAtInternal (Point<float>);
bool isAccessible() const noexcept;
struct ComponentHelpers;
friend struct ComponentHelpers;

View file

@ -330,6 +330,17 @@ struct MenuWindow : public Component
}
else
{
const auto shouldDisableAccessibility = [this]
{
const auto* compToCheck = parent != nullptr ? parent
: options.getTargetComponent();
return compToCheck != nullptr && ! compToCheck->isAccessible();
}();
if (shouldDisableAccessibility)
setAccessible (false);
addToDesktop (ComponentPeer::windowIsTemporary
| ComponentPeer::windowIgnoresKeyPresses
| lf.getMenuWindowFlags());