Thursday, June 13, 2024
HomeiOS Developmentios - UIAccessibility put up announcement not at all times learn if...

ios – UIAccessibility put up announcement not at all times learn if fired by button


I’ve a easy app to announce a textual content when tapping a button. Right here is the code (it is in SwiftUI however the identical conduct arises utilizing UIKit)

struct ContentView: View {
    var physique: some View {
        VStack(spacing: 20) {
            Textual content("Take a look at accessibility")
                .font(.largeTitle)
            Spacer()
            Button {
                let attributedMessage: NSAttributedString = NSAttributedString(
                    string: "Take a look at accessibility announcement",
                    attributes: [
                        .accessibilitySpeechQueueAnnouncement: true
                    ]
                )

                UIAccessibility.put up(notification: .announcement, argument: attributedMessage)
            } label: {
                Textual content("Take a look at accessibility button")
            }
            Spacer()
        }
    }
}

There are two behaviors:

  1. If the accessibility focus is moved to the button and the accessibility information is absolutely learn and I do double faucet to carry out the button motion, the announcement is not learn
  2. If the accessibility focus is moved to the button and whereas accessibility is being learn (however not fully) I do double faucet to carry out the button motion, the announcement is learn

Right here you’ll be able to see it (first ready VoiceOver to learn the complete accessibility information after which double tapping whereas accessibility information is being learn).

Why the announcement isn’t learn within the first case?

Setting accessibilitySpeechQueueAnnouncement to false as a substitute of true provokes the announcement not being learn in any case.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments