VoiceOver: UIAccessibilityLayoutChangedNotification not working - ios

Using VoiceOver, UIAccessibility.post(notification: .layoutChanged, argument: someView) just re-announces the currently focused element instead of moving focus and announcing the accessibilityLabel of someView. Even calling UIAccessibility.post(notification: .layoutChanged, argument: "what the heck") does nothing and just re-announces the currently focused element, when it should announce the string passed in as the argument according to the docs. I'm currently running Xcode 11.3.1 on the simulator. Tried on a physical device as well and same problem. Any help would be gladly appreciated :)

Figured out that this post function only actually focuses on the passed in view when running on a physical device, and seems to be broken on simulator.

It may be that the target element someView is not an Accessibility Element. Check if someView.isAccessibilityElement is set to true.

Related

XCUITest - Search by label for buttons returns two elements (Button and Static Text)

When I search for a button by label only, NSPredicate used to return only the button so that I can tap on it.
But starting from Xcode 11, NSPredicate returns also the staticText inside it.
Thereby I must update all my tests when I tap a button I must specify explicitly the type (Button).
Anyone have the same issue, know if I should update my tests or it's a known bug ?
This behaviour may be caused by a new simulator version. It is pretty common that UI elements hierarchy trees are different on different OS.
Does this problem appear when you use the same simulator you used with Xcode 10?

TPKeyboardAvoiding scrollview defaults to wrong return key type 'Done' in iOS not UIReturnKeyNext

I have used this keyboard avoiding library https://github.com/michaeltyson/TPKeyboardAvoiding in many iOS projects.It works as expected but in a project it is producing a weird issue where return key title is always 'Done' instead of 'Next'.Functionality is still correct like tapping on keyboard 'Done' is making the below UITextField first responder and Tapping the last keyboard 'Done' is resigning the keyboard.
I have used it many iOS versions and both Objective-C and swift projects without any issue
Currently using xcode 8.3.2 with swift
Anyone have similar issue or know the reason for this issue.
[]]
Found this on the github page:
"To disable the automatic "Next" button functionality, change the UITextField's return key type to anything but UIReturnKeyDefault."
This could be the reason for your problem.

iOS - Accessibility methods - moving focus

I am working on an app and trying to make it as accessible as possible. I am trying to move focus to a certain element once an action takes place. I was curious about the difference between these two functions:
UIAccessibilityFocusedElement vs. UIAccessibilityPostNotification
If someone could explain the difference between the two it would be greatly appreciated.
UIAccessibilityPostNotification is used to change things (like focused elements but also pausing and resuming assistive technology like that:
UIAccessibility.post(notification: .pauseAssistiveTechnology, argument: UIAccessibility.AssistiveTechnologyIdentifier.notificationSwitchControl)
UIAccessibility.post(notification: .resumeAssistiveTechnology, argument: UIAccessibility.AssistiveTechnologyIdentifier.notificationSwitchControl)
It can also announce something:
UIAccessibility.post(notification: .announcement, argument: "Say something")
or refresh focus after accessibility scroll
UIAccessibility.post(notification: .pageScrolled, argument: nil)
On the other hand UIAccessibilityFocusedElement can't change anything. It just returns currently focused element (or nil) this way:
UIAccessibility.focusedElement(using: UIAccessibility.AssistiveTechnologyIdentifier.notificationVoiceOver)
On a side note - for now only assistive technology that can be paused or resumed is notificationSwitchControl, trying that with Voice Over causes crashes
If you are trying to move focus to an element based off an actions / screen change scenario.
I think you should probably take a look at:
UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, element_to_be_focused>);
Should be posted when a new view appears that encompasses a major portion of the screen.
or
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, element_to_be_focused);
Should be posted when the layout of a screen changes, for example when an individual element appears or disappears.

Appium: iOS, real device, driver.hidekeyboard() doesn't operate

I'm using Appium on Mac OS with iPhone 5S with operation system 9.2.
When i'm trying to hide the Keyboard with the method:
driver.hidekeyboard();
Nothing happens and the application crash.
Need help please
Thanks
Ohad
If in case your application is crashing on when you are trying to hide the keyboard, then that could be a possible bug you are looking at and to understand the cause of that and get it fixed would be the topmost recommendation. Your statement
driver.hidekeyboard();
is good enough for what you desire out of the execution assuming the driver used is AppiumDriver or its subclass.
Also if you are sure that the keyboard is displayed and you can even manually hide the keyboard, a forced way to do that is as #Gaurav has suggested in the comments using the following code :
driver.navigate().back();
In case of uncertainty of the visibility of keyboard, you can give this a try :
driver.getKeyboard();
driver.hideKeyboard();

UITextField visibility false in appium test iOS

I have devoleped a simple iOS app and on test using Appium all the UIControls staus is shown as visibility false. The below image is the screenshot of the test. I set accessibility label on storyboard
The code I wrote for a simple textfield is given below.
self.txt_txt.isAccessibilityElement = YES;
self.txt_txt.accessibilityElementsHidden=NO;
I have done a little R&D on this and haven't found anything keep 'visibility ' true for UIControls.How to keep visibility true in the above case.If not in code are there any other scripts to run?. Any thoughts are welcome.
I believe this is a bug when using iOS8, based on the information shown in the Appium bug database here:
https://github.com/appium/appium/issues/4131
Looking at the last comment to this bug, it seems that in iOS7 elements are correctly identified as "visible: true", but the same ones in iOS8 are not.
As far as I understand it, at the moment it's not yet clear if this is a bug in Appium or in iOS8.

Resources