Cannot implement UISwitch-like accessibility behavior

Originator:ilya.konstantinov
Number:rdar://34101903 Date Originated:August 27 2017
Status: Resolved:
Product:iOS Product Version:10
Classification: Reproducible:
 
Area:
Accessibility

Summary:
UISwitch announces "Accessibility label, on" (and then hint: "Double tap to toggle") or "Accessibility label, off". When toggling the switch, it simply announces the value "on" or "off" without re-announcing the accessibility label.

If I implement my own control, however, it always announces the accessibility label first (e.g. "Accessibility label, yes"):

Issue was discussed in:
https://lists.apple.com/archives/accessibility-dev/2017/Aug/msg00015.html

Steps to Reproduce:
class MyControl: UIControl {
    public var value: Bool = false

    override func accessibilityActivate() -> Bool {
        self.value = !self.value
        self.accessibilityValue = self.value ? "yes" : "no"
        return true
    }
}

Expected Results:
Control announces "yes" or "no" every time I double-tap.

Observed Results:
Control announces "Accessibility label, yes" or "Accessibility label, no" every time I tap it, where "Accessibility label" is the label I've assigned to the control.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!