Skip to content

bug(@angular/google-maps): Unable to preventDefault inside passive event listener invocation on <google-map> #29482

@chestongo

Description

@chestongo

Is this a regression?

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

The previous version in which this bug was not present was

No response

Description

When using the component and scrolling over it, the inspector console shows the following error:

main.js:138 Unable to preventDefault inside passive event listener invocation.

This error occurs when zooming in or out on the map, making it impossible to hide the error. Additionally, it triggers the outer scroll, causing the entire window to scroll when interacting with the map, which is not user-friendly.

Attempts to Fix:
I have tried several methods to resolve this issue, but none have been successful:

•	Adding (wheel) or (scroll) events and using $event.preventDefault() results in the error being triggered twice.

Reproduction

1.	Integrate the <google-map> component into an Angular project.
2.	Open the application in a browser.
3.	Scroll over the map to zoom in or out.
4.	Observe the error in the inspector console.

Expected Behavior

•	No error should appear in the console when zooming in or out on the map.
•	Scrolling within the map should not trigger the outer window scroll.

Actual Behavior

•	The error Unable to preventDefault inside passive event listener invocation. appears in the console.
•	Scrolling within the map also triggers the outer window scroll.

Environment

•	Angular Version: 18.0.6
•	<google-map> Component Version: 18.1.2
•	Browser: Chrome
•	Operating System: Node v22.1.0, Mac

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions