Element focus change on iOS
Whenever an element receives focus, it should not automatically trigger an event which changes context
. Example of changing context include, but are not limited to: automatically submitting data, opening a new screen or moving to another element. Focus should only be moved deliberately by the user.
On iOS, you can use the UIAccessibilityFocus
protocol to listen to focus changes. The accessibilityElementDidBecomeFocused
method is called whenever an element receives focus.
Be careful when using the accessibilityElementDidBecomeFocused
method: do not trigger any context change because they might confuse users.
class View: UIView {
override open func accessibilityElementDidBecomeFocused() {
// Do not change context
}
}