lolochristen / OpenLayers.Blazor

An Map component for Blazor based on OpenLayers with support for swisstopo swiss maps.
MIT License
37 stars 13 forks source link

@onclick not working within OpenStreetMap Popup #80

Closed mennowo closed 1 week ago

mennowo commented 1 week ago

Currently I'm trying to navigate to a different page when the user clicks on a link inside a marker popup:

<OpenStreetMap @ref="_map" Style="width:100%;height:100%;" @bind-Center="_center" AutoPopup>
    <Popup>
        <div id="popup" class="ol-box">
            @if (context is IntersectionMarker marker)
            {
                <h3>@marker.Name</h3>
                <p>@marker.Description</p>
                @* Neither of these work *@
                @* <p><a class="nav-link" href="/somepage/@marker.InternalId">Analyse</a></p> *@
                @* <button @onclick="@(()=>NavigationManager.NavigateTo($"/somepage/{@marker.InternalId}"))">Test</button> *@
            }
        </div>
    </Popup>
</OpenStreetMap>

I also tried routing onclick to a method I declared on my IntersectionMarker class (which derives from Marker, but no luck either. Am I doing this the wrong way? I'm rather new to Blazor, so maybe what I'm trying does not make any sense.

My aim is to have a few links related to a marker, that the user can click to go to a marker-specific page.

mennowo commented 1 week ago

This was due to an addon in Firefox ("ClearUrls"). Disabling that addon made everything work normally. Sorry for the confusion!