From 79ded8c1f3917b012afb197f2299ace6c357c35d Mon Sep 17 00:00:00 2001 From: attila Date: Wed, 23 Jul 2025 14:17:34 +0200 Subject: [PATCH] PopupMenu: Fix accessibility issue where ticked items couldn't be pressed The issue became manifest in c51b331318aff1485df862694bd562c3bae1a62f. In our implementation the toggle action takes precedence over the press action, making the latter unreachable when the Item is in a checkable state. Calling isTicked (true) turns the Item into a checkable object. The onToggle implementation however didn't interact with the isTicked state, and it didn't fire the press action either. This made the item non-interactable with screen readers once it got into a ticked state. --- modules/juce_gui_basics/menus/juce_PopupMenu.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp index 1f6b591890..7055dc7646 100644 --- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp +++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp @@ -250,7 +250,7 @@ private: } private: - static AccessibilityActions getAccessibilityActions (ItemAccessibilityHandler& handler, + static AccessibilityActions getAccessibilityActions (ItemAccessibilityHandler&, ItemComponent& item) { auto onFocus = [&item] @@ -260,16 +260,7 @@ private: item.parentWindow.setCurrentlyHighlightedChild (&item); }; - auto onToggle = [&handler, &item, onFocus] - { - if (handler.getCurrentState().isSelected()) - item.parentWindow.setCurrentlyHighlightedChild (nullptr); - else - onFocus(); - }; - - auto actions = AccessibilityActions().addAction (AccessibilityActionType::focus, std::move (onFocus)) - .addAction (AccessibilityActionType::toggle, std::move (onToggle)); + auto actions = AccessibilityActions().addAction (AccessibilityActionType::focus, std::move (onFocus)); if (canBeTriggered (item.item)) {