Perform accessibility audits for your app

RSS for tag

Discuss the WWDC23 Session Perform accessibility audits for your app

Posts under wwdc2023-10035 tag

1 result found
Sort by:

Post

Replies

Boosts

Views

Activity

iOS:How to code accessibility, that if user tap on the parent view then whole view should speak, if user tap the child view so only it should be speak
0 I am adding a demo code here of my problem. For this I have created a parent view in which I have 2 child views, I have added "accessibilityElement(children: .combine)" code to the parent view, which combines all the elements while I tap on the view. but I want if the user tap on the parent view then the voiceover should speak all views but if the user taps on a button, then it should separately speak the button. Requirement: If the user taps on the parent view then it should speak all the elements of the view but if the user taps on the button then it should only speak the button, not the full view again. Demo Video link: https://drive.google.com/file/d/1aOuDoTiDizQstfEHiTy-8OoGqXcD_uk0/view?usp=sharing In this video, I want if the user taps on the button it should speak only button, not the full view again. The sample code: import SwiftUI struct ContentView: View { var body: some View { VStack(alignment: .leading, spacing: 10) { topView Button("Show details") { print("Tapped show detail") }.accessibilityElement() .accessibilityLabel(Text("This is show detail")) // I want if user tap on this button separatly then it should only speak the button lable only, not the full content again. bottomView }.accessibilityElement(children: .combine) // By this code it will read the topView, button, and bottomView .padding() } @ViewBuilder private var topView: some View { VStack(alignment: .leading, spacing: 5) { Text("First Text") Text("Second Text") } } @ViewBuilder private var bottomView: some View { VStack(alignment: .leading, spacing: 5) { Text("Third Text") Text("Fourth Text") } } } Requirement: If the user taps on the parent view then it should speak all the elements but if the user taps on the button then it should only speak the button, not the full view again.
1
1
1.7k
Jul ’23