-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[google_maps_flutter_web] Fix consumeTapEvents for Circles, Polygons & Polylines (#173921) #9838
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
[google_maps_flutter_web] Fix consumeTapEvents for Circles, Polygons & Polylines (#173921) #9838
Conversation
In the Google Maps JS API, CircleOptions.clickable and PolygonOptions.clickable default to true. The web implementation did not explicitly set these values, causing shapes to always consume tap events regardless of consumeTapEvents. Explicitly setting clickable fixes the issue so GoogleMap.onTap is triggered when consumeTapEvents = false.
|
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request addresses a bug where consumeTapEvents = false was not being correctly handled for Circles and Polygons on the web, causing them to consume tap events instead of letting them pass through to the map. The fix involves mapping the consumeTapEvents property to the clickable option in the Google Maps JavaScript API for both circles and polygons. My review includes a suggestion to improve the changelog entry for stylistic consistency and points out that the fix is incomplete as it does not cover Polylines, which are also affected by the same issue.
packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart
Show resolved
Hide resolved
packages/google_maps_flutter/google_maps_flutter_web/CHANGELOG.md
Outdated
Show resolved
Hide resolved
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
mdebbar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this issue!
The fix looks good to me. Would you mind doing the same for Polyline too? That would ensure the fix is applied consistently across all shapes.
packages/google_maps_flutter/google_maps_flutter_web/lib/src/convert.dart
Show resolved
Hide resolved
@mdebbar Thanks for the feedback! I’ve applied the same fix for Polyline as well, so it’s now consistent across all shapes. |
mdebbar
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍 (I saw this on Discord looking for another review, I'm not expert in this package but the changes look good to me.)
… Polygons & Polylines (flutter#173921) (flutter/packages#9838)
flutter/packages@092d832...fe66130 2025-08-23 engine-flutter-autoroll@skia.org Roll Flutter from 26bb33b to edd434a (14 revisions) (flutter/packages#9874) 2025-08-23 surajsinhrathod75@gmail.com [google_maps_flutter_web] Fix consumeTapEvents for Circles, Polygons & Polylines (#173921) (flutter/packages#9838) 2025-08-22 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Fixes Android IllegalStateException caused by uninitalized `MediaPlayer` (flutter/packages#9861) 2025-08-22 engine-flutter-autoroll@skia.org Roll Flutter from d2ac021 to 26bb33b (20 revisions) (flutter/packages#9872) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#174373) flutter/packages@092d832...fe66130 2025-08-23 engine-flutter-autoroll@skia.org Roll Flutter from 26bb33b to edd434a (14 revisions) (flutter/packages#9874) 2025-08-23 surajsinhrathod75@gmail.com [google_maps_flutter_web] Fix consumeTapEvents for Circles, Polygons & Polylines (flutter#173921) (flutter/packages#9838) 2025-08-22 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Fixes Android IllegalStateException caused by uninitalized `MediaPlayer` (flutter/packages#9861) 2025-08-22 engine-flutter-autoroll@skia.org Roll Flutter from d2ac021 to 26bb33b (20 revisions) (flutter/packages#9872) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#174373) flutter/packages@092d832...fe66130 2025-08-23 engine-flutter-autoroll@skia.org Roll Flutter from 26bb33b to edd434a (14 revisions) (flutter/packages#9874) 2025-08-23 surajsinhrathod75@gmail.com [google_maps_flutter_web] Fix consumeTapEvents for Circles, Polygons & Polylines (flutter#173921) (flutter/packages#9838) 2025-08-22 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Fixes Android IllegalStateException caused by uninitalized `MediaPlayer` (flutter/packages#9861) 2025-08-22 engine-flutter-autoroll@skia.org Roll Flutter from d2ac021 to 26bb33b (20 revisions) (flutter/packages#9872) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
…r#174373) flutter/packages@092d832...fe66130 2025-08-23 engine-flutter-autoroll@skia.org Roll Flutter from 26bb33b to edd434a (14 revisions) (flutter/packages#9874) 2025-08-23 surajsinhrathod75@gmail.com [google_maps_flutter_web] Fix consumeTapEvents for Circles, Polygons & Polylines (flutter#173921) (flutter/packages#9838) 2025-08-22 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Fixes Android IllegalStateException caused by uninitalized `MediaPlayer` (flutter/packages#9861) 2025-08-22 engine-flutter-autoroll@skia.org Roll Flutter from d2ac021 to 26bb33b (20 revisions) (flutter/packages#9872) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-packages-flutter-autoroll Please CC flutter-ecosystem@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md

This PR fixes a bug in google_maps_flutter_web where
consumeTapEvents = falsewas still consuming tap events for Circle and Polygon overlays.Previously, even when consumeTapEvents was set to false, taps on circles or polygons would prevent events from reaching the map beneath them. With this fix, the behavior is now consistent with mobile platforms — taps pass through when consumeTapEvents = false.
Fixes flutter/flutter#173921
Version and Changelog
Pre-Review Checklist
[shared_preferences]pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or I have commented below to indicate which version change exemption this PR falls under1.CHANGELOG.mdto add a description of the change, following repository CHANGELOG style, or I have commented below to indicate which CHANGELOG exemption this PR falls under1.///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.Footnotes
Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. ↩ ↩2 ↩3