googlemaps / googlemaps/js-markerwithlabel

Update to google.maps.marker.AdvancedMarkerElement to Address Deprecation Warning

Open
#1,037 3 comments 4 reactions 0 assignees View on GitHub
triage me type: bug
Dominant language
TypeScript
Stars
77
Forks
20
PR merge metrics
No merged PRs in 30d

Description

**Description:**

This library currently uses the `google.maps.Marker` class to implement marker functionality. However, as of February 21st, 2024, `google.maps.Marker` is marked as deprecated. When using this library, a console warning appears in the browser stating:

> _As of February 21st, 2024, google.maps.Marker is deprecated. Please use google.maps.marker.AdvancedMarkerElement instead._

This deprecation notice suggests that the library needs to transition to using the new `google.maps.marker.AdvancedMarkerElement` to ensure future compatibility with the Google Maps JavaScript API.

**Steps to Reproduce:**

1. Use the `js-markerwithlabel` library in a project.
2. Open the browser console when the map and markers are rendered.
3. Observe the deprecation warning related to `google.maps.Marker`.

**Proposed Solution:**

Update the library to replace usages of `google.maps.Marker` with `google.maps.marker.AdvancedMarkerElement`. This update may require additional adjustments to account for differences in behavior and API between the two marker implementations.
This will be a breaking change since the new `google.maps.marker.AdvancedMarkerElement` does not put almost any methods on the returned marker object compared with the legacy marker (eg all of the get and set methods).

**Additional Information:**

- [Deprecation Notice Documentation](https://developers.google.com/maps/documentation/javascript/releases#3.56.1)

Updating this library will prevent issues with breaking changes in the Google Maps JavaScript API after the deprecation deadline and maintain compatibility for users of `js-markerwithlabel`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.