Renetik
Renetik

Reputation: 6373

Why there is warning in Android Studio clickable attribute found please also add focusable

I dont like to do much stuff in layout with xml, but I can read it well and everything is working. Why this warning is there ? I can disable it for sure, but I just don't understand it. I just want that bottom view catch click events so they don't get under, this seems working good and clickable is doing it, so I don't need focusable there at all, but I see it...

Upvotes: 13

Views: 4962

Answers (1)

dgngulcan
dgngulcan

Reputation: 3149

For accessibility purposes. For instance, if the user is navigating through the keyboard, they can not move onto the clickable item without focusable attribute, hence cannot click.

Reference: https://android.googlesource.com/platform/tools/base/+/studio-master-dev/lint/libs/lint-checks/src/main/java/com/android/tools/lint/checks/KeyboardNavigationDetector.java?autodive=0%2F

Upvotes: 20

Related Questions