react-google-maps-api icon indicating copy to clipboard operation
react-google-maps-api copied to clipboard

Strange behavior of the information window

Open alexkobylansky opened this issue 1 year ago • 4 comments

163300 171544

Strange behavior of the information window. When I click on the marker, a small empty window appears, which should not be.

alexkobylansky avatar Apr 23 '24 14:04 alexkobylansky

I have the same issue while using it with cluster. It will be nice to see implementaion guide for markers + infowindows + cluster; because i have issue with passing ref from AdvancedMarker to InfoWindow

AdamZajlerDDH avatar Apr 26 '24 08:04 AdamZajlerDDH

I wrote some dirty client-side code to deal with this issue:

const handleMarkerClick = useCallback((location) => {
    setActiveMarker(location);
    setTimeout(() => {
      const infoWindowElements = document.querySelectorAll('.gm-style-iw, .gm-style-iw-c');
      infoWindowElements.forEach(element => {
        const children = Array.from(element.children);
        if (children.length === 2 && (!children[0].children.length || !children[1].children.length)) {
          element.parentElement.style.display = 'none';
        }
      });
    }, 50);
  }, []);
    ```

ggu avatar May 31 '24 05:05 ggu

I'm having the same issue. @ggu I'm curious about why did you choose to hide the parent element instead of removing it?

nimlevy avatar Sep 06 '24 22:09 nimlevy

I'm having the same issue.

@ggu I'm curious about why did you choose to hide the parent element instead of removing it?

I can't remember, but should be fine to remove.

ggu avatar Sep 09 '24 16:09 ggu