Accessibility

RSS for tag

Make your apps function for a broad range of users using Accessibility APIs across all Apple platforms.

Posts under Accessibility tag

130 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

XCUITest fails because of accessibility not loading
Hi all, I ran into an XCUITest issue where my tests fail randomly with the message that my app "has not loaded accessibility" I run the tests in my scheme in random order and with every run, some other random test fails and a test that previously failed would later pass. So I know it's not my test as-such that is causing the problem. There seems to be a 60s wait for accessibility to load, and I have not found any information how I could extend the timeout or convince accessibility to load faster. I found some older posts, but no real solution was found there either. This completely blocks my test execution since I cannot get a single run in where the tests all pass (and I only have 10 tests in that scheme). I ran the scheme against an iOs sim and against a real iOS device and I get the same random accessibility errors on either execution platform. I've tried iOS17.2 & 17.4 and get the same behavior. Strange enough, the test actually keeps running (and technically passes all the checks and asserts in the actual test) after the accessibility error, but then XCTest marks it as failed because of the early accessibility error. Any ideas what I could try or what the reason could be? Thanks! -- I'm using XCode Version 15.3 (15E204a) and test iOS17.2 and iOS17.4 Test Case '-[MyScheme.MyTestClass testMyFunction]' started. t = 0.00s Start Test at 2024-04-19 01:32:09.225 t = 0.02s Set Up t = 0.02s Open com.myCompany.myApp t = 0.03s Launch com.myCompany.myApp t = 0.25s Wait for accessibility to load t = 60.30s Capturing diagnostic spindump /Users/some/path/goes/here/MyTestCase.swift:120: error: -[MyScheme.MyTestClass testMyFunction] : Application 'com.myCompany.myApp' has not loaded accessibility t = 60.34s Waiting 60.0s for "test" Button to exist t = 61.38s Checking `Expect predicate `exists == 1` for object "test" Button` t = 61.39s Checking existence of `"test" Button` ... more stuff happening in the test here ...
1
0
387
Apr ’24
Assigning accessibility label for UIActivityViewController
I'm trying to get voiceover to announce accessibility label for UIActivityViewController (for a share sheet that pops up on clicking share button) before the focus goes to one of activity items inside the UIActivityViewController. In order to achieve the above behavior, I'm just assigning accessibilityLabel for UIActivityViewController's view. But looks like I'm not able to override the default accessibility implementation of UIActivityViewController. Is there any way we could override the existing accessibility behavior of UIActivityViewController and announce accessibility label for share options? Thanks in advance!!
1
0
270
Apr ’24
How to correctly use Accessibility Identifiers for Rows of Elements
So I have a simple view for my SwiftUI application below: import SwiftUI struct ContentView: View { var body: some View { List { ForEach(0..<4) { index in RowView(index: index) .accessibilityIdentifier("row") } } } } struct RowView: View { let index: Int var body: some View { HStack { Image(systemName: "globe") .imageScale(.large) .foregroundStyle(.tint) Text("Hello, world!") Spacer() ButtonView(index: index) } .padding() } } struct ButtonView: View { let index: Int var body: some View { VStack { if index != 3 { Button(action: {}, label: { Text("Cancel") }) .accessibilityIdentifier("cancel_button") } Button(action: {}, label: { Text("Submit") }) .accessibilityIdentifier("submit_button") } } } My goal is to reference each cancel and submit button per row for a UI Test, which I have tried doing so here: let rowElements = app.tables.cells.matching(identifier: "row") for i in 0..<rowElements.count { let cancelButton = rowElements.element(boundBy: i).buttons["cancel_button"] let submitButton = rowElements.element(boundBy: i).buttons["submit_button"] XCTAssertTrue(cancelButton.exists, "Cancel button does not exist in row \(i)") XCTAssertTrue(submitButton.exists, "Submit button does not exist in row \(i)") } Even with the identifiers set like this my tests fail and say it cannot find the buttons labeled as they are with their specific identifiers or the rows. What is the correct way to reference elements if they are in a list or table for UI Testing? I'm specifically trying to use accessibility Identifiers to make my life easy.
2
0
359
3w
CGEventTapCreateForPid fails to get event tap
My app uses CGEventTapCreateForPid to monitor keyboard events of a corresponding process. My app has already enabled the Accessibility permission, and AXIsProcessTrustedWithOptions returns true. However, CGEventTapCreateForPid returns null. What could be the problem? Does anyone know? I tested and found that if CGEventTapCreateForPid returns null, I can reset the Accessibility permission using tccutil reset Accessibility myapp_bundleid without restarting my app. But my app can still get the permission through AXIsProcessTrustedWithOptions
2
0
318
Apr ’24
Changing Accessibility Settings from Within a Script
Hello, Recently, I've been hacking at trying to find a way for the colors of the system cursor to be changed via an executable (in particular, I'm trying to get them to match the foreground/background colors chosen by wal.) In my most recent investigation, I've located the relevant setting in ~/Library/Preferences/com.apple.universalaccess (which is a wierd place for it to be, but w/e) and attempted to change it via defaults write. This immediately caused all my GUI apps including Finder to crash repeatedly until I went into recovery mode and deleted the changed file. My next direction in this quandary, then, is to make an application that asks for the relevant Accessibility settings (via the standard prompt that I often see) and upon being granted proper permission, is able to make the modifications without breaking the system. Is anyone able to point me towards the documentation for such functionality, if it's possible? Preferably some kind of C or shell interface.
0
0
309
Apr ’24
Accessibility API permissions on sandboxed app
Hello 👋, I am quite new in the Apple development world, so please forgive me if I am saying something wrong. I am working on a macOs application which aims to act mainly as an assistive window switcher. In order to do so it leverages on AXUIElementCopyAttributeValues and AXUIElementCopyAttributeValue, especially the former to retrieve other application's window titles and the latter to set and focus a target main window. I read online, according to Apple Store guidelines, that app to be accepted in App Store must be sandboxed. And as I read in several forums there may not be a way to use accessibility features within sandbox. So, first question, based on this I would like to know if there is a way to achieve the same without accessibility features? Currently the only thing which does not work is the permission prompt, but an user may also enable Accessibility permissions under Privacy & Security for a certain app. May the app pass the review process, supposing no prompt will be requested to the user, but a "Getting started" will inform and guide the user to set the permissions? Thanks in advance 🙏
1
0
476
Apr ’24
Accessibility : Full keyboard access with scroll view in swiftui
I have checked almost all previous question related to my query but did not find my solution. I'm facing issue with Full keyboard access accessibility when integrate it with scrollview. Inside scrollview textfield and secure textfield are accessible with "tab" key but other component like buttons are not accessible using "tab" key. but when I remove scrollview all elements are accessible with "tab" key. Even in system installed iOS Apps they don't support scrollview with tab button, I have analysed apple documentation regarding this but did not find specific to this. Does anyone have idea regarding this kind of behaviour?
1
0
455
Apr ’24
Should UIAlertController title be announced as header by voiceover
Voiceover of UIAlertController by default announces title's accessibilityTrait as static text. I'm trying to change the accessibilityTrait to be of type header and can't seem to have a direct way to access title label and modify the attribute. Only solution seems to be to add custom label to be able to modify accessibilityTrait. Now, this got me wondering should the default behavior of UIAlertController be left untouched? Have anyone else tried to do this? And, is there any other way to customize accessibilityTrait of UIAlertController title label that I'm missing out on? Thanks in advance.
2
0
387
Mar ’24
ISSUE: iPhone validation issue while entering English Characters using Japanese Keyboard
Application: HTML,Javascript,Angular web Application Issue: In Iphone/Ipad while trying to enter English characters using Japanese keyboard in the input field the japanese keyboard freezes and stops working after entering the first character. Root Cause: Two validations given in the onInput call back method causes the issue. when the validation are removed keyboard is working fine 1.for converting lowercase letters to uppercase 2.Some Character are not allowed so they are replaced after input
0
0
467
Mar ’24
Deep link to Accessibility->Personal Voice
My app speaks and offers the user the ability to use their Personal Voice - but if the user says "No" when I first ask them for permission to use their Personal Voice, I can never ask them again. So if they change their mind later - they have to go to Settings->Accessibility->Personal Voice to toggle the permission for my app. To make things easier for them, I would like to be able to pop open that page for them - but I don't know how to create the URL for it. Is it even possible? The closest I've been able to get is to open the settings page for my app (Settings->My App Settings) with: guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {return } if UIApplication.shared.canOpenURL(settingsUrl) { UIApplication.shared.open(settingsUrl) } Thanks in advance!
0
0
341
Mar ’24
(API to) switching device/display using keyboard with Universal Control
Universal Control works to share keyboard and mouse from one mac to another, but actually switching seems to require physically moving the mouse to the other display. Ideally, I'd like Apple to support some command available via command-key equivalents to cycle to other devices in the way that we can cycle through applications or windows. Seeking to program that directly, I was unable to find any Universal Control API's on point. Are there any? I can imagine restricted this to the OS only for security. In case there are display-driven API's, I see that system settings/displays shows all the displays from all devices, but I was unable to find a UI or API's to change focus to another display (other than moving the mouse to select the display). When I list displays programmatically, I only see the device-local displays. In case there are device-driven APIs: I can initialize a bluetooth session and secure credentials, but interaction seems to be unavailable.
1
0
382
Mar ’24
Extension views called from ASCredentialProviderViewController prepareInterface cannot be accessible through Keyboard
Any extension views called from ASCredentialProviderViewController -> open func prepareInterface(forPasskeyRegistration registrationRequest: ASCredentialRequest) cannot be accessed through Keyboard (Setting->Accessibility->Keyboards->Full Keyboard Access enabled). I have to manually type the prompted screen once to be able to get focused and continue to use Keyboard. Is it a known issue or I am missing anything? Please suggest. Thanks!
1
0
431
Mar ’24
Can't override 'perform escape gesture' VoiceOver to block going back to previous screen
This is the situation: one of the flows in our app is a navigation stack that consists of several screens. At a certain point in this flow, one of the screens lacks a back button, because we don't want the user to go back to a previous screen in that flow. For sighted users everything works fine. But once a screen reader user activates VoiceOver and uses the perform escape gesture (2 fingers right-left-right) the app does go back to the previous screen! We tried to override accessibilityPerformEscape (both in UIKit and SwiftUI) and do nothing in that method and in case of UIKit return true. That blocks going back when you're focusing on an element on the screen that belongs to the presented screen/viewController (not to the navigationBar). But once the user is focused on the navigationBar and performs the escape gesture, the user can still go back. We tried to override again the accessibilityPerformEscape on the UINavigationController level and the UINavigationBar level but they are not even called.
0
0
327
Mar ’24
Why doesn't my app show up in the accessibility list?
Hello guys, In a macOS app developed with SwiftUI and swift, the NSAccessibility key has been added to the Info.plist file to explain why the app requires Accessibility permissions, and also the AXIsProcessTrustedWithOptions function has been called, but the app is not seen in the system's Accessibility list. I thought, it will show up in the system's Accessibility list like following Some of my code import SwiftUI @available(macOS 13.0, *) @main struct LOKIApp: App { @State private var activeWindow: NSWindow? = nil @State private var accessibilityGranted = false var body: some Scene { MenuBarExtra("App Menu Bar Extra", image: "trayicon") { Button("Settings") {} .keyboardShortcut("s") Divider() Button("Quit") { NSApplication.shared.terminate(nil) } .keyboardShortcut("q") }.menuBarExtraStyle(.menu) } init() { let options: NSDictionary = [kAXTrustedCheckOptionPrompt.takeRetainedValue() as NSString: true] let accessibilityEnabled = AXIsProcessTrustedWithOptions(options) if accessibilityEnabled == true { print("Accessibility is enabled") } else { print("Accessibility is not enabled. Please enable it in System Preferences") } } } I didn't do any other configuration, and test this app by using the command Command+R, need I set provisioning profile? Please help, thank you.
0
1
498
Mar ’24
SwiftUI Bug in Voice Over when app language is French
My app language is set to French. If my device language is set to French, I do not see this issue. If my device language is set to English, In the app, voice over reads all UIKit views with female voice (French accent), and all SwiftUI view with male voice (French accent). Is this a bug with SwiftUI or UIKit ? I would expect the gender voice should not be changed irrespective of UIKit/SwiftUI views. I tried many ways, but none fixed the issues. I am not sure what is causing this or how to fix this. Our app is majorly built in UIKit and we started to use SwiftUI views for small views, and if this accessibility issues continue, we would like to stop using SwiftUI. Some of the ways I tried are: Set the locale of swiftUI view .environment(\.locale, "fr-CA") I could not find anything in the documentation that could address this.
1
1
342
Mar ’24
Swift Charts Accessibility Bug
I've been working on migrating some graphics to Swift Charts for an app I work on. However I've been noticing strange behavior when it comes to VoiceOver. If I create a bar chart and use: BarMark(x: .value("Month", x, unit: .month), y: ...) While the chart looks fine, the voice over values seem to follow arbitrary values set for the bin. From what I can tell they are following the underlying bin values that Swift Charts uses to provide spacing between bars. For instance, this simple example: let monthlyRevenueData = [ (x: try! Date("2024-01-01T00:00:00Z", strategy: .iso8601), y: (income: 55000, revenue: 124000), id: UUID()), (x: try! Date("2024-02-01T00:00:00Z", strategy: .iso8601), y: (income: 58000, revenue: 130000), id: UUID()), (x: try! Date("2024-03-01T00:00:00Z", strategy: .iso8601), y: (income: 59000, revenue: 120000), id: UUID()), ] struct ContentView: View { var body: some View { Chart(monthlyRevenueData, id: \.id) { (x, y, _) in BarMark(x: .value("Month", x, unit: .month), y: .value("Income", y.income)) .foregroundStyle(.green) BarMark(x: .value("Month", x, unit: .month), y: .value("Revenue", y.revenue)) } } } #Preview { ContentView() } Results in the Voice Over reading "January 14th 2024 at 12 AM to January 28th 2024 at 12am ..." despite the fact that the data should be for the entire month of Jan. Is there any way to get VoiceOver to read the input data rather than relying on how the chart is formatted? Preferably without the need to remove all visual spacing between the bars. Video link: https://drive.google.com/file/d/11mxCl3wR2HzoOaihOvci-vZk4zgG1d39/view?usp=drive_link
0
0
391
Mar ’24
Important Accessibility Option - Native Keyboard Input
I want to trigger a "pinch" where I can select whatever it is I'm looking at via pressing spacebar on a bluetooth keyboard that is paired with the apple vision pro. Is this feasible in Xcode or Unity (VisionOS development) where I not only have access to see native keyboard presses, but also can see the gaze position (or what it's currently highlighting/focusing on) without accessing it through an interaction event. If keyboard press, then select item being gazed at. We wont have "pinch" available for people with hand/arm impairments that will trigger an interaction event, and there are an array of accessibility devices that send keyboard commands that would be able to aid in this. Apple should have this ability in it's native settings, specifically with using keyboard commands as well. This app would demonstrate that ability without it being native yet, and any help would be greatkly appreciated :)
0
0
345
Mar ’24
Full keyboard access UI elements
Hello, Since the full keyboard access Help menu is a little vague on the nuances between Tab, arrow keys, and Ctrl+tab in terms of navigation, could you point me to where I can find the intended mapping of FKA keys to UI elements? For example, I have been in several Apple iOS apps where the UITabBar at the bottom is navigable with any of the three options mentioned above. In other contexts, the tab key only moves the user to the tab bar section, then the icons are focusable with arrow or Ctrl + tab. When a modal pops up stating I will be leaving an app, should the choices be navigable with Tab? Ctrl+tab? or arrows too? In other places, like news articles in Apple News, it seems that I cannot scroll with the arrow keys to read the various paragraphs, nor interact with links at all that are in the article. If there is a separate keyboard shortcut for links or scrollbar, please update the Help menu. It seems pretty straightforward that arrow keys navigate between HStacks and VStacks. Is that an accurate guess of arrow key behavior? I feel like I'm guessing in several places within the content groups.
4
0
917
Mar ’24