Background
accessibilityElementDidBecomeFocused
method.canBecomeFocused
to always return true
.Accessibility
->Full Keyboard Access
(allowing the user to use the app with just Keyboard). isAccessibilityElement
is also set to true
Problem I have two scenarios
When both Keyboard access and VoiceOver are enabled
In this case accessibilityElementDidBecomeFocused
gets called as expected.
When both Keyboard access is enabled but VoiceOver is disabled
In this case accessibilityElementDidBecomeFocused
isn't getting called.
I asked the same question on Developer apple forums, and one of the apple engineers confirm that indeed this API only works with VoiceOver. https://developer.apple.com/forums/thread/745602?login=true&page=1#778932022
The engineer highlighted the https://developer.apple.com/documentation/uikit/uifocussystem API for Keyboard related focus, where I found and used didUpdateNotification
Notification for my usecase. This notification triggered as expected when I changed focus only using KeyboardAccess