visgl / visgl/react-google-maps

[Bug] AdvancedMarker fires "TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node' when "draggable" is true

Open
#867 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
1.9k
Forks
193
Avg merge
3d 16h
Merged PRs (30d)
13

Description

Description

My stack:

  • React 18.3.1
  • @vis.gl/react-google-maps 1.7.1
  • vite 6.0.7

The code:

        <AdvancedMarker
          position={markerCoordinates}
          // draggable
          // onDragEnd={getGeocodeData}
          collisionBehavior={CollisionBehavior.REQUIRED_AND_HIDES_OPTIONAL}
          anchorTop="-90%"
        >
          <img src={mapPinIcon} alt="pin" />
        </AdvancedMarker>

The error:
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'

This error is getting caused by using the draggable prop on the AdvancedMarker. Removing the prop doesnt cause the crash.

mapPinIcon is a .svg image.

I've tried making a workaround to this by ensuring that AdvancedMarker was getting a Node child, by creating a container with document.createElement and appending an image with appendChild, but it still gives that error.

Image
Steps to Reproduce

In a closed environment it works... So providing a CodeSandbox seems worthless. If you need any kind of additional information I'll provide it ASAP as I'll be looking at this issue constantly

Environment
  • Library version: 1.7.1 (tried also 1.5.1 and 1.5.2)
  • Google maps version: weekly
  • Browser and Version: Chrome 142.0.7444.60
  • OS: MacOS Tahoe 26.0.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the AdvancedMarker entry point and reproduce the reported appendChild error with React 18.3.1, @vis.gl/react-google-maps 1.7.1, draggable enabled, and an SVG image child. Compare behavior with draggable removed; done means identifying and fixing the cause without the crash and confirming the behavior with a reproducible test case.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.