ionic-team / capacitor-plugins

Official plugins for Capacitor ⚡️
522 stars 585 forks source link

googleMaps: Touch position bugged on Android 13 #1357

Closed daviozolin closed 1 year ago

daviozolin commented 1 year ago

Bug Report

Plugin(s)

Capacitor Google Maps

Capacitor Version

@capacitor/cli: 4.3.0 @capacitor/core: 4.3.0 @capacitor/android: 4.3.0 @capacitor/ios: 4.3.0

Platform(s)

Android 13 only

Current Behavior

When the map is loaded, it seems like the touches are detected below where the actual touch happens. This causes, for instance, the wrong menu item being opened. This only happens on Android 13. The same code running on Android 12- works as expected. On the example below, touching the "Gerenciar Assinatura" menu item, detects the touch on the following item, "Meios de Pagamento" and opens that page. Same happens with the next one, touching "Meus veículos" opens "Extrato de Uso". Same happens on the "Go to my location" button, the touch is recognised below it. ezgif com-gif-maker

Tested on Samsung S21, Samsung S21 FE and Android Emulator Pixel 4 API 33

Expected Behavior

The touch should be detected in it's actual position.

Code Reproduction

Here is a sample app: https://github.com/marlon-ionic/ng14-ssfcu-cap-map-sidemenu

marlon-ionic commented 1 year ago

Created a simple reproduction app: https://github.com/marlon-ionic/ng14-ssfcu-cap-map-sidemenu

daviozolin commented 1 year ago

Very nice, @marlon-ionic, thank you for this!

daviozolin commented 1 year ago

Anyone has any news on this? Or maybe a workaround? It's directly impacting our production app 🫠

xdelvalle commented 1 year ago

I'm in the same situation :(

kavdev commented 1 year ago

Glad it's not just me. @jcesarmobile this is what I was running into in https://github.com/ionic-team/capacitor-plugins/issues/1277

sven-s commented 1 year ago

I would love to see a workaround or a solution, since I am having the same problem.

kavdev commented 1 year ago

I would love to see a workaround or a solution, since I am having the same problem.

Also, if anyone has a slight idea of where to start looking, please post. I'm happy to dig in and troubleshoot, but interfacing with android apis is new to me and I'm just going to be guessing.

daviozolin commented 1 year ago

I have been trying to manage a workaround, shifting visually the elements while keeping the clickable area in the same position, but that didn't work either. I'm currently considering going back to the Javascript SDK while this isn't fixed, because this bug makes the app unusable :(

kavdev commented 1 year ago

My current hypothesis is that the issue is somewhere within the mechanism to get the vertical map bounds:

In my next troubleshooting session, I want to try changing the "y" value in the js config to see if it affects the issue: https://github.com/ionic-team/capacitor-plugins/blob/main/google-maps/android/src/main/java/com/capacitorjs/plugins/googlemaps/CapacitorGoogleMap.kt#L480

daviozolin commented 1 year ago

I have tried changing it as you said, and it had no effect on my tests. I ran in parallel two emulator instances, one running Android 13 and the other Android 12. With the same Y value for the config file, Android 12 worked fine and Android 13 still had the same issue.

Also the dispatchTouchEvent function is only triggered when interacting with the map itself, not the elements drawn over it, so I'm not sure how it interferes with the issue.

kavdev commented 1 year ago

Maybe the fact that the map is placed "under" the app on android is moving things around? Instantiating the map causes the issue, but the issue goes away as soon as the map is destroyed.

kavdev commented 1 year ago

Also clicking any of map markers doesn't seem to have an issue; it only affects anything placed on top of the map.

ionitron-bot[bot] commented 1 year ago

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.