-
Notifications
You must be signed in to change notification settings - Fork 337
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
While using accessibility(TalkBack) on popups on Android, Focus also goes to background view.[Bug] #585
Comments
hey @HirakCTS could you provide a minimal project, and steps to reproduce the Accessibility talk back for Android. if you can give me this, I can go about debugging your issue. Also, are you able to check if the issue remains after you have updated to latest, as well as latest xamarin forms |
@LuckyDucko I am using prism for popups. I have also raised issue with them and xamarin as well, but unable to find solution. Also, I am using latest version of xamarin and all the related libraries. |
I appreciate you going through the effort with this. In the sample app, it seems that focus isn't moving onto the popup page, but instead remaining on the page behind. However, if you are able to tap on a UI element within the popup page that has no interact-able UI elements underneath, then the talkback correctly focuses on the popup view only. i'll investigate more when I can, however, it seems that the error is due to the talkback getting confused on what page 'Context' it should be reading from. |
I am seeing this same issue, using Rg.Plugins.Popup 1.2.0.223 and Xamarin.Forms 4.8.0.1451. |
Hi @LuckyDucko - also seeing this issue. Is there any workaround? |
@WilliamWatterson86 I haven't looked at this in a while, and I'm unsure how to go about it fixing it to be honest. To be clear, do you get it with the latest version? |
Thanks @LuckyDucko. Yes I updated today and it still happens. I only see it on android, iOS seems ok. I made a bit of a hack today and check if voice over is on and if it is I set the page that would be in the background to IsVisible false when navigating to the popup page, then back to true when I navigate back. So this hides the background page and so the elements aren’t selectable anymore. Looks a bit odd when the page in the background disappears but I think it’s fine as a temp workaround. |
Were you having issues with iOS in anything below say, version 2.0.0.5? |
@LuckyDucko - I have just tried it with 2.0.0.4, and it seems to work fine with that version too. So unless the fix was before that? |
@WilliamWatterson86 it was just a shot in the dark, it could be one before that aswell, or it could be fixed through xamarin/new version of iOS. Still have android to work out though |
Hi, I'm experiencing the same issue and I don't think Xamarin Forms will fix this since it's specific to popups. We're using your plugin because Xamarin doesn't support this feature. So I do think it has to be fixed here. iOS works fine, Android does not. Since a lot of apps in Europe will have to comply to accessibility features by law, we are looking for workarounds or other plugins. Would be great if it could be fixed. Edit: for now I'm trying the hacky workaround by @WilliamWatterson86 |
I'm sorry I haven't dedicated time to this, keeping up with projects can be time consuming. if you, or anyone else, could provide a quick zip project with the following that would be helpful.
Then I can swap out the nuget for the rg project, and begin debugging. I may be able to work out a fix. if you can figure out which version of iOS it started 'working' with, that would be helpful in figuring out if android can also have the same fix |
Hi @LuckyDucko , i am facing this issue too. I am attaching the sample zip file here. you can reproduce the issue with it. any solution to fix this, please update ASAP. Thank you :) |
@LuckyDucko here is the sample video !! 20210302_194347.mp4 |
@HirakCTS I believe that the current behaviour is intentional as it is visible even using displayalert However, @WilliamWatterson86 stumbled on a nifty trick that would seem to fix this problem, except that you have to make the background page Using this trick, I was able to create a little snippet and attach it onto the AccessibilityManager am = (AccessibilityManager)Android.App.Application.Context.GetSystemService(Android.Content.Context.AccessibilityService);
page.Parent = XApplication.Current.MainPage;
if (am.IsEnabled)
{
XApplication.Current.MainPage.IsVisible = true;
} Another way I was looking at it, which may be better, is to go about and switch off the accessibility of the children below the popup using public Task AddAsync(PopupPage page)
{
var decoreView = DecoreView;
RecursivelyChangeAccessibilityOfViewChildren(XApplication.Current.MainPage.GetOrCreateRenderer().View, ImportantForAccessibility.No);
page.Parent = XApplication.Current.MainPage;
var renderer = page.GetOrCreateRenderer();
decoreView?.AddView(renderer.View);
return PostAsync(renderer.View);
}
private void RecursivelyChangeAccessibilityOfViewChildren(Android.Views.View view, ImportantForAccessibility important)
{
if (view is ViewGroup vGroup)
{
for (int i = 0; i < vGroup.ChildCount; i++)
{
Android.Views.View vChild = vGroup.GetChildAt(i);
vChild.ImportantForAccessibility = important;
vChild.ClearFocus();
RecursivelyChangeAccessibilityOfViewChildren(vChild, important);
}
}
} The upside to this one, Background stays as is. Downside being there is a bunch more going on each time you add a page & if you made some accessibility customisations to the original page, they will be wiped out and reset to auto when the popup is removed. They both won't work if you layer popups on top of one another, but that's an issue for later. Regardless of the solution we go for, I think If people think this solution is good enough (and give me a good name for the feature switch), I'll create a PR for it. 👍 |
The latest version, 2.0.0.11, has a special fix added in that should make talkback far more functional. see #657 for information |
@LuckyDucko i tried with the upgrade, now the focus is going to the entire layout of the backgroundscreen and talkback continuously reading all the child elements. |
Really? can you share with me a sample project? It should read everything that's on the popup page, and ignore everything in the background. However, I am unsure how well it works if its popup on popup |
@LuckyDucko u can use the same sample https://github.com/rotorgames/Rg.Plugins.Popup/files/6069169/XFAccesibilitySample.zip . I just upgraded to latest version and tried. The background screen is getting focussed and It is reading all the buttons (all controls on the screen) text continuously :( . |
did you add on the special flag for it? I haven't got any Android Devices floating around to double check unfortunately. However, when I do, I will update the sample to include the use as a demo |
@LuckyDucko yes i set it to true. The focus on to the individual elements(i.e buttons in this sample) in the background is not happening (as expected),but the entire page is getting focused and it starts reading all the controls(I.e buttons ). I wish you would fix it ASAP when u got an android device with you. |
@uday-lucky I am confused, wouldn't you want it able to read the controls? |
@LuckyDucko you can see this , how it is behaving after upgrading .. 20210403_125835.mp4 |
@uday-lucky I see, thank you for quickly pulling this up for me, I got so carried way with talkback no longer focusing on the background I didn't wait to see it's completion. I'll get right on it |
@uday-lucky this is an updated version, I think I got it mostly fixed, and made it much simpler, however, I dont know how to stop it announcing the previous pages title. See if this works, and ill make a new PR |
Hi, can I ask what is the workaround for blocking talkback from speaking the child of the parent view? My current project really need this right now |
@deadmanproqn Hoping that my newer code works, you have several options option B is what you will see in the sample I uploaded that you quoted. I also added a video showing how its down (on vs4mac, but im sure its a similar process on normal VS) just make sure you have the correct branch (AccessibilityUpgrade585) AddingAsReference.mp4 |
Thank you for your quick reply, I will use option B for testing first and use the new release when it comes out |
@deadmanproqn tell me how it goes, hope it works out well! |
To recursively hide from TalkBack you can use View.ImportantForAccessibility = Android.Views.ImportantForAccessibility.NoHideDescendants;. This should affect the view and all it's children recursively. I'm doing this on the main layout of the page in Xamarin.Forms to stop any controls on the page behind the popup from getting the TalkBack focus. Generally it looks like you want to set it back to "Auto" afterwards. I found you also need to grab the Toolbar view and do the same on it otherwise any toolbar buttons will still take the TalkBack focus. |
@LuckyDucko , sorry missed that. Looks good. |
@LuckyDucko Thanks for your effort. I've implemented the AndroidTalkbackAccessibilityWorkaround on my popups and it works with most of them. I have a GenericPopupPage that I use throughout the app, but it doesn't work on all pages. So I was wondering if it matters which page it goes on top of. For example my root is of type TabbedPage, and it seems that it doesn't work specifically on that page. If I navigate to other pages where I have the same popup page, this fix works very well! |
@McFlemchSoda This is great news! I was kinda worried about another (big) issue coming up with these like my last attempt. Could you provide a mini example and I'll try and see what's going on. Is it just tabbedpage you have noticed it with? I wonder if its because of the tabbedpage being a many-in-one page that perhaps is confusing my code? im sure there will be something I can do on my end that fixes this up! |
@LuckyDucko Hi! I tried making a test project but could not reproduce it. I went back to my own project and somehow it does work now. I'm not sure what changed, but I'll keep testing to see if it was all me or if I can find a combination where it doesn't work. Xamarin.Forms isn't always reliable either haha. Sorry for wasting your time, appreciate your help! |
@McFlemchSoda that's all good, if it does show itself again let me know! |
@LuckyDucko I am still getting the issue that @uday-lucky was experiencing. I have updated their reproduction project to have the latest Rg.Plugins.Popup NuGet package. However, in XFAccesibilitySampleNavBar.zip Thanks, |
@BurkusCat this is interesting, I'll look into this. As in #681 I noticed it would read anything visible with words on a page. |
@LuckyDucko I found a strange behavior when using the workaround property. If at any point the workaround code gets triggered, the focus in different pages gets very confused. Repro steps: Page1 and Page2 are not adjacent in the Navigation stack. What I mean is that you don't open the one from the other, they are completely unrelated. If I never open Page2, everything is fine. However, after Page2 opens, which means the workaround code gets called, the focus on Page1 gets confused and exists simultaneously at all the Entries. This happens even if TalkBack is not active I have tried setting the workaround to True only if TalkBack is enabled. However, if TalkBack gets disabled at any point, the issue reproduces. |
🐛 Bug Report
I am using popups in Android. While i turned on accessibility, focus of TalkBack also goes to dimmed background view. It supposed to stay on the popup only.
Actual Behavior - Focus goes to background view as well. Breaking functionality of accessibility.
Focus supposed to stay on popup view only
Reproduction steps
Configuration
Version: 1.x
Platform:
The text was updated successfully, but these errors were encountered: