js-markerclusterer
js-markerclusterer copied to clipboard
Google maps warns about using click instead of gmp-click event.
This is the error in the browser console from google maps.
addListener(a, b) {
"click" === a && console.warn(`<${this.localName}>: ${"Please use addEventListener('gmp-click', ...) instead of addListener('click', ...)."}`);
return _.K(this, a, b)
}
I I am not getting this error when not using the marker clusterer.
If you would like to upvote the priority of this issue, please comment below or react with :+1: so we can see what is popular when we triage.
@coder6652 Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:
- Check the issue tracker - bugs and feature requests for Google Maps Platform APIs and SDKs
- Open a support case - Get 1:1 support in Cloud Console.
- Discord - chat with other developers
- StackOverflow - use the
google-mapstag
This is an automated message, feel free to ignore.
Which version of the markerclusterer are you seeing this in?
I’m using [email protected].
This is the CDN:
I hope this is the right version?
If you cannot reproduce it, please let me know.
It is only a warning and everything still works but you don’t want that showing up in the browser console.
Something you should know. I was trying to get the OnClusterClick handler to work and I got it to work but only when using this syntax. markerCluster.onClusterClick = function (e, cluster) { … }
Then, I was trying to figure out how to change the background and glyph color of a specific cluster.
I had to use the cluster.marker.content property which is an HTMLElement that is an SVG and then I had to find the fill attribute and change the color by changing the three fill attributes that define the text color, background color, and glyph color. It worked but it took several hours to figure this out. I am not sure if there is an easier way to do this?
From: Alex Muramoto @.*** Sent: Friday, May 12, 2023 1:00 PM To: googlemaps/js-markerclusterer @.> Cc: coder6652 @.>; Mention @.***> Subject: Re: [googlemaps/js-markerclusterer] Google maps warns about using click instead of gmp-click event. (Issue #611)
Which version of the markerclusterer are you seeing this in?
— Reply to this email directly, view it on GitHub https://github.com/googlemaps/js-markerclusterer/issues/611#issuecomment-1546032282 , or unsubscribe https://github.com/notifications/unsubscribe-auth/A6SJEEUFWWHJUM77TXGYBRDXFZUB5ANCNFSM6AAAAAAX6S7WXI . You are receiving this because you were mentioned.Message ID: @.***>
I am seeing this with 2.1.3 as well but the it looks like the pb is rather the JS maps API:
Looking at the docs for gmp-click:
Notice: Available only in the v=beta channel.
@jeantimex is gmp-click something we can feature detect? If not it might be a little bit of a pain because our choices would be:
a) use click and get the warnings and it might stop at working at some point
b) use gmp-click and it will not work on the weekly channel and with older (i.e. fixed) versions of the API.
What are your thoughts here?
I don't think there is anything to do here while gmp-click is only in the beta version.
Once/If it makes its way into the weekly channel we should feature detect the way to add click listeners.