-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(android): ListView tap not working after setting children as focusable #10522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(android): ListView tap not working after setting children as focusable #10522
Conversation
@CatchABus only issue I see is that it is not synced with isUserInteractionEnabled.if accessibility is disabled then focusable seems to not be linked to isUserInteractionEnabled
|
We still have the following scenario. We have this view: <stacklayout></stacklayout> Even though this.isUserInteractionEnabled && this.nativeViewProtected.isFocusable() So if we keep [accessibilityEnabledProperty.setNative](value) {
// ensure `accessibilityEnabled=false` does not disable focus for view with `isUserInteractionEnabled=true`
this.nativeViewProtected.setFocusable(!!value || this.isUserInteractionEnabled && this.nativeViewProtected.isFocusable());
if (value) {
updateAccessibilityProperties(this);
}
} What do you think? |
@CatchABus You are right. Feels like a lot of things need to be fixed there. |
6e10d9b
to
87a5a92
Compare
@CatchABus @farfromrefug @NathanWalker The change done here https://github.com/NativeScript/NativeScript/pull/10522/files#diff-ff996ba7476badc71c6c2ce6924be412385d3ea43a8785248a28159b3f7d203eR19 is breaking Maestro tests on Android. For example I have a test where a <StackLayout :testID="item.testId" class="mt-10">
<!-- .... -->
</StackLayout> I understand that there's a TODO comment to update this eventually, but in the meantime is there a way to workaround this? With this update Android is untestable. |
Update in relation to my above comment: Adding <StackLayout :testID="item.testId" :accessible="true" class="mt-10">
<!-- .... -->
</StackLayout> Of course this would mean that we'd need to go through all of our code and see where this is needed. |
This PR along with the referenced one are attempts to keep things stable with changes in #10482. |
@CatchABus Here i will let N team decide what to do. In my fork i decided to disable accessibility by default on views so i dont have that commit https://github.com/NativeScript/NativeScript/pull/10522/files#diff-ff996ba7476badc71c6c2ce6924be412385d3ea43a8785248a28159b3f7d203eR19. |
@NathanWalker @CatchABus, any ideas on a way forward here please? As a summary with the above changes I see two main issues:
|
These points are definitely important but not connected to the current PR as it's a fix addition on top of another 2 PRs and doesn't implement optional a11y focus itself. |
@farfromrefug @dangrima90 @NathanWalker I believe we should proceed with reverting all recent a11y changes related to this until we come with a good solution that's tested thoroughly. |
@CatchABus i say yes. |
@dangrima90 Core 8.8.6 should take care of it. Let us know. |
Hi @CatchABus I can confirm that I was able to successfully access elements via |
Thank you so much! |
PR Checklist
What is the current behavior?
We had reports that android ListView
itemTap
event stopped working at core 8.7 and later.The problem seemed to be that ListView proxy views became focusable due to some a11y calls, thus breaking native item click listener. A thread in StackOverflow explains why ListView does not operate well if list items become focusable: https://stackoverflow.com/questions/11610023/click-is-not-working-on-the-listitem-listview-android
What is the new behavior?
Views will become focusable or non-focusable only when needed.
This is a continuation of the previous fix related to WebView accessibility focus: 92b2ff8
@farfromrefug Let me know if there's room for any improvements.