iOS: UIAccessibility (Voice Over) with checkbox is not working properly

谁都会走 提交于 2019-12-24 17:03:51

问题


I am using voice over on checkbox. 


The issue I am facing here is, when user selects the checkbox for the first time it says 'checkbox selected' (which is correct as per accessibilityLabel set) but next time when user tries to de-select it says 'checkbox selected, checkbox de-selected' where it should only say 'checkbox de-selected', vice-a-versa. 


So what is happening here is that, the previously set accessibilityLabel is not getting cleared up and when user tries to select or de-select it takes the both previous and currently set label.
 


Note- using custom checkbox, toggling UIButton with selected/de-selected image.

How to solve this conflict? 


回答1:


If you create your checkbox thanks to a UIButton item, I suggest to :

  • Untick the button UIAccessibilityTraits.
  • Provide a clear hint when the checkbox is first selected : "double tap to change the value".
  • Update your button accessibility label thanks to IBAction when the box is toggled.

However, it's always better to create a UIAccessibilityElement that contains your check box and a label that describes what it refers to ⟹ when you double tap this accessible wrapper with one finger, the checkbox value toggles and your initial problem disappears.

Following these steps will provide an appropriate user experience with no checkbox VoiceOver conflict that you noticed.



来源:https://stackoverflow.com/questions/52857383/ios-uiaccessibility-voice-over-with-checkbox-is-not-working-properly

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!