Skip to content
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

fix: prevent gmp-click warnings when using AdvancedMarkerElement #954

Merged
merged 3 commits into from
Feb 10, 2025

Conversation

Mobiletainment
Copy link
Contributor

As of February 21, 2024, google.maps.Marker is deprecated in favor of google.maps.marker.AdvancedMarkerElement. When handling click events:

  • Standard google.maps.Marker uses the "click" event.
  • The newer google.maps.marker.AdvancedMarkerElement requires "gmp-click" instead.

This fixes the warning: Please use addEventListener('gmp-click', ...) instead of addEventListener('click', ...). which occurs when advanced markers are used.

Thank you for opening a Pull Request!


Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open a GitHub issue as a bug/feature request before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #611 🦕

As of February 21, 2024, `google.maps.Marker` is deprecated in favor of `google.maps.marker.AdvancedMarkerElement`. When handling click events:
- Standard `google.maps.Marker` uses the `"click"` event.
- `google.maps.marker.AdvancedMarkerElement` requires `"gmp-click"` instead.

This fixes the warning: `Please use addEventListener('gmp-click', ...) instead of addEventListener('click', ...).` which occurs when advanced markers are used.
src/markerclusterer.ts Outdated Show resolved Hide resolved
@usefulthink usefulthink merged commit e43e3e7 into googlemaps:main Feb 10, 2025
12 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 10, 2025
This fixes the warning: `Please use addEventListener('gmp-click', ...) instead of addEventListener('click', ...).` which occurs when advanced markers are used.

---------

Co-authored-by: Martin Schuhfuss <m.schuhfuss@gmail.com> e43e3e7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Google maps warns about using click instead of gmp-click event.
2 participants