Element focus change on Android
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 Android, you can use an OnFocusChangeListener
to listen to focus changes. The onFocusChange
method is called when the element receives focus.
Be careful when using the onFocusChange
method: do not trigger any context change because they might confuse users.
webView.setOnFocusChangeListener { view, focused ->
if (focused) {
// Do not change context
}
}