[FIXED] Android: Prevent keyboard navigation on entire view (Accessibility)

Issue

When a popup is opened, the view behind the popup can still be navigated using keyboard navigation.

Video attached to this github issue –
https://github.com/rotorgames/Rg.Plugins.Popup/issues/728

From looking at the source code it adds an Android.View on top of the current Android.View.
So need to away to prevent keyboard navigation focus of the original view and then enable it once the popup is closed.

Solution

Setting the ViewGroup DescendantFocusability to BlockDescendants while the popup is open, then setting it to AfterDescendants when the popup is closed.

Android doc – https://developer.android.com/reference/android/view/ViewGroup#attr_android:descendantFocusability

((ViewGroup)view).DescendantFocusability = DescendantFocusability.BlockDescendants;
((ViewGroup)view).DescendantFocusability = DescendantFocusability.AfterDescendants;

This is the PR that fixed the issue – https://github.com/LuckyDucko/Mopups/pull/23

Answered By – IeuanW

Answer Checked By – Clifford M. (Easybugfix Volunteer)

Leave a Reply

(*) Required, Your email will not be published