cashapp / AccessibilitySnapshot

Easy regression testing for iOS accessibility
Apache License 2.0
541 stars 67 forks source link

Should it consider userInputLabels in addition (if available) ? #85

Closed jhneves closed 2 years ago

jhneves commented 2 years ago

https://github.com/cashapp/AccessibilitySnapshot/blob/68f9270211893bcbb8a9b1b9d02e71303de35e26/Sources/AccessibilitySnapshot/Core/Swift/Classes/UIAccessibility%2BSnapshotAdditions.swift#L23

Would it make sense to consider the userInputLabels when parsing for the accessibilityLabel? ie:

        if #available(iOS 13.0, *) {
            var userInputLabelsTagged: String = ""
            for i in 0..<accessibilityUserInputLabels.count {
                if i > 0 {
                    userInputLabelsTagged += " "
                }
                userInputLabelsTagged += "[\(i)]"
                userInputLabelsTagged += accessibilityUserInputLabels[i]
            }
            if !userInputLabelsTagged.isEmpty {
                accessibilityDescription = userInputLabelsTagged
            }
        }

That would produce something like: "[0]some primary label text [1]some secondary explanation of the label text"

jhneves commented 2 years ago

closing, since this is a dup of: https://github.com/cashapp/AccessibilitySnapshot/issues/59