Skip to content

Commit

Permalink
PopupMenu Accessibility: Report menu-item ticked state on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
reuk committed Mar 7, 2022
1 parent 7b1fba4 commit c51b331
Showing 1 changed file with 2 additions and 27 deletions.
29 changes: 2 additions & 27 deletions modules/juce_gui_basics/menus/juce_PopupMenu.cpp
Expand Up @@ -187,29 +187,6 @@ struct ItemComponent : public Component
PopupMenu::Item item;

private:
class ValueInterface : public AccessibilityValueInterface
{
public:
ValueInterface() = default;

bool isReadOnly() const override { return true; }

double getCurrentValue() const override
{
return 1.0;
}

String getCurrentValueAsString() const override
{
return TRANS ("Checked");
}

void setValue (double) override {}
void setValueAsString (const String&) override {}

AccessibleValueRange getRange() const override { return {}; }
};

//==============================================================================
class ItemAccessibilityHandler : public AccessibilityHandler
{
Expand All @@ -218,9 +195,7 @@ struct ItemComponent : public Component
: AccessibilityHandler (itemComponentToWrap,
isAccessibilityHandlerRequired (itemComponentToWrap.item) ? AccessibilityRole::menuItem
: AccessibilityRole::ignored,
getAccessibilityActions (*this, itemComponentToWrap),
AccessibilityHandler::Interfaces { itemComponentToWrap.item.isTicked ? std::make_unique<ValueInterface>()
: nullptr }),
getAccessibilityActions (*this, itemComponentToWrap)),
itemComponent (itemComponentToWrap)
{
}
Expand All @@ -242,7 +217,7 @@ struct ItemComponent : public Component
}

if (itemComponent.item.isTicked)
state = state.withChecked();
state = state.withCheckable().withChecked();

return state.isFocused() ? state.withSelected() : state;
}
Expand Down

0 comments on commit c51b331

Please sign in to comment.