cloud-sdk-ios-fiori
cloud-sdk-ios-fiori copied to clipboard
ObjectItem doesn't support accessibility for `detailImage` Image values
Describe the bug
ObjectItem detailImage
view VoiceOver accessibility is broken. For Image(systemName: "headphones") system image not announced, For Image("pdfIcon", label: Text("Some text")) label not announced, detailImageModifier
doesn't solve issue with modifiers.accessibilityLabel()
or .accessibilityValue()
To Reproduce For Examples.xcodeproj replace content of the ContentView.swift with following code: ` import FioriCharts import SwiftUI import FioriCharts import FioriSwiftUICore import FioriCharts import FioriSwiftUICore import SwiftUI
/* Image(systemName: "headphones") // system image label not announced Image("pdfIcon", label: Text("Some text")) // some text not accounced */
struct ContentView: View { var body: some View { ObjectItem(title: "Some title 1", subtitle: "Some subtitle 2", footnote: "Some footnote", status: .text("Some status"), detailImage: Image(systemName: "headphones")) .padding([.leading, .trailing], 16) .accessibilityElement(children: .combine) .environment(.horizontalSizeClass, .compact) } } `
- Enable
Accessibility
->Voice Over
- Launch the app
- Observe that image label is not pronounced, both options below handled by system correctly when used alone, but not when inside ObjectItem.
- Image(systemName: "headphones") // system image label not announced
- Image("pdfIcon", label: Text("Some text")) // some text not accounced
Expected behavior Image element labels are pronounced correctly by VoiceOver as Image element used alone.
Screenshots
Mobile (please complete the following information):
Device: iPhone 8 OS: iOS 15.5 Swift Package Product: FioriSwiftUICore Swift Package Version: 2.1.0, main branch, commit https://github.com/SAP/cloud-sdk-ios-fiori/commit/a82de93715b34e0b834f1993c85e3488018f41bc Xcode Version: Version 13.4 (13F17a), toolchain Xcode Version 13.4 (13F17a) FioriSwiftUI / cloud-sdk-ios-fiori 2.1.0
Additional context Add any other context about the problem here.
Hi Didzmitry,
using accessibilityElement(children: .combine)
will skip Image
which can be verified with this standalone example
HStack {
Image(systemName: "headphones")
Text("Hello, World")
}
.accessibilityElement(children: .combine)
https://user-images.githubusercontent.com/4176826/174906358-27dc3a78-9872-407d-808c-800d5c9d92f7.mov
Using your provided code without this accessibility modifier then image gets announced
ObjectItem(title: "Some title 1", subtitle: "Some subtitle 2", footnote: "Some footnote", status: .text("Some status"), detailImage: Image(systemName: "headphones"))
.padding([.leading, .trailing], 16)
https://user-images.githubusercontent.com/4176826/174906714-1cf438ea-0eae-4001-80af-b3601c6536c5.mov
If you want a different default behavior then you could set a custom accessibilityLabel
for the container
.accessibilityElement(children: .ignore)
.accessibilityLabel("Card representing image \(semanticImageTextVariable)")
As Marco stated, this is expected behavior by Apple APIs. Not an issue from SDK itself. Marco also provided the working code.