Unfortunately, the ‘isTicked’ parameter doesn’t seem to show up anywhere. Since its a popup menu there’s no value, the title is unchanged, etc… basically the ticked status of the menu seems invisible to screen readers, at least on macOS.
From perusing the code, it seems isTicked is only used to draw the checkmark icon.
So is there an easy way to show ‘isTicked’ in the screen readers? Right now our users find our menus a bit confusing because they have items which depend on the tick mark to show the selected state and they can’t get that in their accessible tools.
After a bit more investigation, I’m not sure whether that’s the right approach. I think it’d be better to reveal the value of the item directly to the screen reader using the item’s ‘Value’. If I inspect Xcode’s menus in the Accessibility Inspector, I see that the tick-able items have a Value property which is either “on” or “off” (or “None” if the item doesn’t have an associated value). I’ll see if I can find a nice way of doing that.
So I don’t think this is quite correct. On windows our users report that the voiceover NVDA and JAWS don’t announce ticked state and seem to think the item is readonly? On mac it shows up in accesibility but not in voice over.
Here’s the full report:
Also something interesting I noticed regarding menus, the checked state isn’t reported on Windows and Mac anymore, but if I have NVDA read detailed info what’s focused with Caps+Tab, the checked items get spoken as “read only” so it sounds like the wrong attribute is being set
I’m going to restore our ‘ticked’ text for now but I think there’s some stuff still wrong here.
Thanks for reporting. I’ve had another go; the state seemed to be reported correctly in NVDA/Narrator/VoiceOver in the DemoRunner, so hopefully this will work for you too:
Hey guys, sorry to revive an old thread, but we’ve encountered a quite-related issue:
We’ve noticed that for PopupMenus, if you VO+Space (in a screen reader) on a ticked item, it just loses highlight and leaves the menu open. If you click the already ticked item with the mouse though, it closes the menu and finishes the showMenuAsync callback as a user would expect. Pressing Enter/Return while the ticked item is highlighted has the same effect as a mouse click.
After some digging into the library code, we noticed that calls to onToggle weren’t triggering any items. Adding in a call to trigger items that are checkable fixed our issue (and feels logical). With this, VO+Space correctly handles a ticked item, changing its state and exiting out of the menu. Here’s a diff of what we did:
diff --git a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp
index 78ec7a8291..565e01204e 100644
--- a/modules/juce_gui_basics/menus/juce_PopupMenu.cpp
+++ b/modules/juce_gui_basics/menus/juce_PopupMenu.cpp
@@ -287,7 +287,11 @@ private:
auto onToggle = [&handler, &item, onFocus]
{
if (handler.getCurrentState().isSelected())
+ {
+ if (handler.getCurrentState().isCheckable())
+ item.parentWindow.triggerCurrentlyHighlightedItem();
item.parentWindow.setCurrentlyHighlightedChild (nullptr);
+ }
else
onFocus();
};
We checked through DemoRunner and noticed the same behavior in MenusDemo. Would it be possible to get the above patch made? The isCheckable() bit is necessary because of the withCheckable() change made in the above commit.
Beyond this, we’ve noticed that items are only announced to the screen reader as being checkable after they’re already ticked as seen in the commit above. Is there a best practices way for displaying to the screen reader that an item is toggleable in all states?
Hey guys, just checking back in on this, as well as adding in some additional findings regarding our local fix:
We noticed that if an item in a PopupMenu is ticked, when you VO + Down Arrow past it or VO + Up Arrow past it, the onToggle() lambda mentioned above gets called. This doesn’t seem entirely correct as we shouldn’t be toggling without calling the toggle and/or press actions from the screen reader. Since our fix was adding a call to trigger the currently selected item (if it’s “checkable”) during the onToggle() lambda, our menus break when you scroll past a ticked item.
Is this the correct intended behavior for onToggle()? If so, we’ll need to look at a different fix.