components icon indicating copy to clipboard operation
components copied to clipboard

bug(google-maps): Warning in Console about adding Event-Listener for click instead of gmp-click

Open phrei opened this issue 8 months ago • 7 comments
trafficstars

Is this a regression?

  • [x] Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

I'm getting the following warning in console when I use @angular/[email protected]:

<gmp-advanced-marker>: Please use addEventListener('gmp-click', ...) instead of addEventListener('click', ...).

Would this mean the following code should be changed to gmp-click as suggested in the warning?

https://github.com/angular/components/blob/1b721a03faca95636d202660167ff35c2399bdfb/src/google-maps/map-advanced-marker/map-advanced-marker.ts#L136

Reproduction

Create a project that uses the (mapClick)-Output on a <map-advanced-marker>

Expected Behavior

No warning in console.

Actual Behavior

Warning in console.

Environment

  • Angular: 19.2.1
  • CDK/Material: 19.2.2
  • Google-Maps: 19.2.2
  • Browser(s): Chrome
  • Operating System: Windows

phrei avatar Mar 07 '25 08:03 phrei

Hmm interesting, something along these lines came up for #30420 and we couldn't use addEventListener, because it was only available in the beta channel of the Maps API.

crisbeto avatar Mar 07 '25 11:03 crisbeto

Playing with it a bit more, even when using addEventListener('gmp-click') it behaves weirdly. The handler doesn't get fired and it still logs some warning from the clusterer.

crisbeto avatar Mar 07 '25 12:03 crisbeto

Hello,
I’m experiencing the same issue with <gmp-advanced-marker> in @angular/[email protected].

My setup:

  • Angular version: 19.1.3
  • @angular/google-maps version: 19.2.2
    • Browser: Chrome

king-martinien avatar Mar 08 '25 00:03 king-martinien

I'm experiencing the same issue on a Nuxt app using google maps. Even though I don't use .addListener("click", I still get those warnings.

martinarcejoviva avatar Mar 27 '25 10:03 martinarcejoviva

I'm getting the same issue in Vue3 using [email protected]. I'm also not using .addListener("click", ...).

emilyDZC avatar Apr 07 '25 07:04 emilyDZC

same

boycany avatar Apr 21 '25 06:04 boycany

Add me to the list!

onorok avatar May 12 '25 18:05 onorok