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

PopupMenu: Fix accessibility issue where ticked items couldn't be pressed

The issue became manifest in c51b331318.
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.
This commit is contained in:
attila 2025-07-23 14:17:34 +02:00 committed by Attila Szarvas
parent b1e19da5f5
commit 79ded8c1f3

View file

@ -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))
{