I have a work-around. Rather than using a <div> tag in my blade that calls the map-component.... I have used the more HTML5 friendly <section> tag.
Add Listener fails if content contains certain element
I have a Livewire 3 project using the latest version of Google Maps. I use the new Dynamic Library Import bootstrap loader to load the map successfully and am able to place AdvancedMarkerElements where I want them.
The issue I have is that when I try to add an event listener to a marker, if the content contains a <div> element, then I get the root element error
Livewire only supports one HTML element per component. Multiple root elements detected for component: [monitoring]
So
marker.addListener('click', ({ domEvent, latLng }) => {
const { target } = domEvent;
const contentString = `
<div>
<h1>${name}</h1>
<div>${description}</div>
</div>
`;
infoWindow.close();
infoWindow.setContent(contentString);
infoWindow.open(marker.map, marker);
});
doesn't work, but as soon as I remove the <div> and </div> the content renders perfectly. I also tried a <div wire:ignore.self but that didnt work either.
Obviously I need to format and layout a infoWindow card... so this is a show stopper for me.
Please or to participate in this conversation.