The49.Maui.BottomSheet
The49.Maui.BottomSheet copied to clipboard
Image Tap Gesture Recognizer Not Triggered in BottomSheet on .NET MAUI
Issue
I've encountered an issue with the TapGestureRecognizer not triggering within a BottomSheet in a .NET MAUI project.
The specific scenario involves an Image control with a TapGestureRecognizer. When the image is tapped, the corresponding event handler is not invoked. This issue is present when using the BottomSheet from the The49.Maui.BottomSheet library.
Here is a simplified code snippet:
<Image Source="icon_yes.svg"
WidthRequest="80"
HeightRequest="80">
<Image.GestureRecognizers>
<TapGestureRecognizer Tapped="OnYes_Tapped" />
</Image.GestureRecognizers>
</Image>
The method OnYes_Tapped is not triggered when the image is tapped.
Workaround
Use keyboard 'tab' btn + ImageButton
As a workaround, I tried using an ImageButton instead of Image, and used the Clicked event which seems to work, but it's not ideal since it requires users to use the keyboard to trigger the event. Here is the workaround:
<ImageButton Source="icon_yes.svg"
Clicked="OnYes_Tapped"
WidthRequest="80"
HeightRequest="80">
</ImageButton>
This issue might be specific to the emulator I'm using or could be related to the interaction between the TapGestureRecognizer and the BottomSheet library.
This issue affects the usability of the application as it requires keyboard interaction (Use keyboard 'tab' btn) which is not expected behavior for tap gestures on touch interfaces.
Hint:
I can assume that this might be an Z-Index issue but it's just a guess
At this moment I'm not able to provide the example sample for this issue.
I hope you`ll be able to reproduce and investigate this problem without additional code sample
thank you for your effort and good luck 💪
Hi,
Is it an issue on iOS, Android or both? I have come across a similar issue on iOS and fixed it in rc1
I have not had any issues on Android, but rarely use the gesture recognizer for click/tap events, so I might not have caught this bug
Hi @AvgustPol . Is this still an issue with the recent versions?