Skip to content

Commit 51089f8

Browse files
committed
possible fix
1 parent 2ad6bcf commit 51089f8

File tree

2 files changed

+37
-14
lines changed

2 files changed

+37
-14
lines changed

Rg.Plugins.Popup/Platforms/Android/Impl/PopupPlatformDroid.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System;
2+
using System.Linq;
23
using System.Text;
34
using System.Threading.Tasks;
45

@@ -69,6 +70,25 @@ static void HandleAccessibilityWorkaround(PopupPage page)
6970
XApplication.Current.MainPage.Navigation.ModalStack[modalCount - 1].GetOrCreateRenderer().View.ImportantForAccessibility = ImportantForAccessibility.NoHideDescendants;
7071
}
7172

73+
DisableFocusableInTouchMode(XApplication.Current.MainPage.GetOrCreateRenderer().View.Parent);
74+
}
75+
}
76+
77+
static void DisableFocusableInTouchMode(IViewParent? parent)
78+
{
79+
var view = parent;
80+
string className = $"{view?.GetType().Name}";
81+
82+
while (!className.Contains("PlatformRenderer") && view != null)
83+
{
84+
view = view.Parent;
85+
className = $"{view?.GetType().Name}";
86+
}
87+
88+
if (view is Android.Views.View androidView)
89+
{
90+
androidView.Focusable = false;
91+
androidView.FocusableInTouchMode = false;
7292
}
7393
}
7494
}
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
<?xml version="1.0" encoding="utf-8" ?>
2-
<rg:PopupPage xmlns="http://xamarin.com/schemas/2014/forms"
2+
<rg:PopupPage x:Class="Demo.Pages.UserAnimationPage"
3+
xmlns="http://xamarin.com/schemas/2014/forms"
34
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
4-
xmlns:rg="http://rotorgames.com"
55
xmlns:animations="clr-namespace:Demo.Animations;assembly=Demo"
6-
x:Class="Demo.Pages.UserAnimationPage">
7-
<rg:PopupPage.Animation>
8-
<animations:UserAnimation/>
9-
</rg:PopupPage.Animation>
10-
<StackLayout VerticalOptions="Center" HorizontalOptions="Center">
11-
<Frame BackgroundColor="Silver">
12-
<StackLayout Spacing="20">
13-
<Label HorizontalOptions="Center" Text="User Animation" FontSize="16"></Label>
14-
<Button Text="Close" Clicked="OnClose"></Button>
15-
</StackLayout>
16-
</Frame>
17-
</StackLayout>
6+
xmlns:rg="http://rotorgames.com"
7+
AndroidTalkbackAccessibilityWorkaround="True">
8+
<rg:PopupPage.Animation>
9+
<animations:UserAnimation />
10+
</rg:PopupPage.Animation>
11+
<StackLayout HorizontalOptions="Center" VerticalOptions="Center">
12+
<Frame BackgroundColor="Silver">
13+
<StackLayout Spacing="20">
14+
<Label FontSize="16"
15+
HorizontalOptions="Center"
16+
Text="User Animation" />
17+
<Button Clicked="OnClose" Text="Close" />
18+
</StackLayout>
19+
</Frame>
20+
</StackLayout>
1821
</rg:PopupPage>

0 commit comments

Comments
 (0)