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
[Android] PlatformView tap coordinates mapping incorrectly when in a scroll view #146570
Comments
Thanks for the report. I was able to replicate this on latest versions. stable, master flutter doctor -v
|
From customer: This seems to only seems to happen with 3.19 and is blocking the ability to upgrade to the latest version of Flutter for their production app |
Any updates I am also facing the same issue |
Confirmed that this reproduces on master, and is fixed with a clean revert of flutter/engine#49268. |
Looks like we could potentially fix this with https://developer.android.com/reference/android/view/MotionEvent#offsetLocation(float,%20float). Input events still seem to be verified after having their location offset. Just need to determine the required offset. |
Fixes flutter/flutter#146570, which tracks a regression from #49268 regarding platform view inputs in some specific cases. This PR translates the input event location to be the same as the location we calculated before #49268, returning to the previous behavior, while maintaining the input event's verified status (I checked this manually with the `InputManager`). Tested manually with the reproduction in the linked issue. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Fixes flutter/flutter#146570, which tracks a regression from flutter#49268 regarding platform view inputs in some specific cases. This PR translates the input event location to be the same as the location we calculated before flutter#49268, returning to the previous behavior, while maintaining the input event's verified status (I checked this manually with the `InputManager`). Tested manually with the reproduction in the linked issue. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Steps to reproduce
Additional notes:
Expected results
Tapping on a PlatformView should always register the tap at the correct coordinates for where the PlatformView is currently being rendered.
Actual results
It is taking the coordinates of where the user tapped on the viewport, and using those exact coordinates in the PlatformView.
Code sample
The provided code sample is the absolute minimum we believe is required for the issue to occur: there needs to be an IndexedStack, at least two PlatformViews, and any PlatformView that doesn't fill the entire screen's height will have the issue.
Note: Forcing the PlatformView to refresh at least once will temporarily "solve" the issue. We did this by setting the key of the webview, waiting for it to load, and then changing the key one time. However, upon switching tabs and going back to the broken page, the issue comes back. To show this, we added a button to this sample that will change the key of the webview.
main.dart
Code sample
html_content.dart (Sample webview content that clearly shows the issue.)
Code sample
Screenshots or Video
Screenshots / Video demonstration
FlutterWebviewIssue.mov
Logs
For logs, see file:
FlutterLogs.txt
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: