visgl / visgl/react-google-maps

[Bug] onMouseEnter on AdvancedMarker only works when onClick is set

Open
#542 4 comments 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

Using the onMouseEnter with a AdvancedMarker is only working when the same AdvancedMarker has a onClick property set.
If I'm using the standar Pin, it works just fine.

Steps to Reproduce
<APIProvider
  apiKey={import.meta.env.VITE_API_GOOGLE_MAPS_API_KEY}
  region="BR"
  language="pt-BR"

>
  <Map
    defaultCenter={{
      lat: -15.4,
      lng: -47.4,
    }}
    defaultZoom={10}
    id="plots-list"
    mapId={import.meta.env.VITE_API_GOOGLE_MAPS_MAP_ID}
  >
    {plotLocations.map((plot) => {
      return <AdvancedMarker position={plot.location} key={plot.id} onMouseEnter={() => console.log('test')}
        onClick={() => {}}
      >
        <div>dummy component</div>
      </AdvancedMarker>
    })}
  </Map>
</APIProvider>
Environment
  • Library version: 1.2.0
  • Google maps version: weekly
  • Browser and Version: Chrome 128.0.6613.138 (Official Build) (64-bit)
  • OS: Windows 11
Logs

No response

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

Reproduce the issue with the provided AdvancedMarker TSX example, then inspect AdvancedMarker event handling and compare it with the standard Pin behavior. The fix is complete when onMouseEnter fires without requiring an onClick handler, while the existing reproduction continues to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.