Browse Source

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

v6.1.6
ed 3 years ago
parent
commit
d6fd33b38d
2 changed files with 18 additions and 3 deletions
  1. +7
    -3
      modules/juce_gui_basics/components/juce_Component.h
  2. +11
    -0
      modules/juce_gui_basics/menus/juce_PopupMenu.cpp

+ 7
- 3
modules/juce_gui_basics/components/juce_Component.h 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;


+ 11
- 0
modules/juce_gui_basics/menus/juce_PopupMenu.cpp 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());


Loading…
Cancel
Save