I am trying to set the accessibilityLabel
of a UIMenuItem
and it seems to have no effect. VoiceOver simply reads the title of the item no matter what:
let foo = UIMenuItem(title: "foo", action: #selector(doSomething))
item.isAccessibilityElement = true
item.accessibilityLabel = "bar"
For this item, VoiceOver reads "foo" instead of "bar." Also, the accessibilityHint
seems to be ignored as well.
The UIMenuItem
element is actually a UICalloutBarButton
private class containing a UIButtonLabel
(iOS 13) and, as is, you can't custom its a11y properties even if you can easily code it (informal protocol).
That's insane because, in order to vend an a11y app, you MUST adapt it to the users and that's definitely not the case here.😨
However, a workaround may be implemented as follows to reach your goal:
menuFrame
property) for the next step.UIAccessibilityElement
init + accessibilityFrameInContainerSpace
).It would have been better to create an accessible element for each menuItem (and then provide a better customization) but I didn't find out the way to get the frame of each individual item. 😥
And, unfortunately, this problem is still current for the last 3 years. 😤
⚠️ ⬛️◼️🔳▪️ EDIT ▪️🔳◼️⬛️ ⚠️ (2020/03/19)
I wrote a Developer Technical Support Incident (no 731229763) for this problem and here's the answer from Apple:
Our engineers have reviewed your request and have determined that you are experiencing a known issue for which there is no known workaround at this time.
I submitted a bug report entitled VoiceOver: accessibilityLabel can't be implemented on a UIMenuItem element with the reference FB7623526.
Now, you know why accessibilityLabel is useless and without effects on a UIMenuItem element. 😥
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With