Skip to content

iOS map clicked event fires when tap on pin #11532

@bivant

Description

@bivant

Description

Click/tap on the map pin expands it but on iOS the map fires MapClicked event as well. Same code works on Android as expected (pin reacts on event but the map event callback is not called)

Expected result:
Pin control expands on click/tap + map MapClicked event does NOT fire
iOS Actual result:
Pin control expands on click/tap + map MapClicked event FIRES

iOS screenshots

iOS Map start
iOS Pin clicked
iOS After alert

Android screenshots

Android Map start
Android Pin clicked

Tested on Mac with maui-ios 7.0.100 and on Windows with SDK 7.0.100

Steps to Reproduce

Create a new project. Add map
Replace MainPage with code below

MainPage
public partial class MainPage : ContentPage
{
	public MainPage()
	{
        InitializeComponent();

        var pinLocation = new Location(20.7557, -155.9880);
        
        MapSpan mapSpan = MapSpan.FromCenterAndRadius(pinLocation, Distance.FromKilometers(3));
        map.MoveToRegion(mapSpan);
        map.Pins.Add(new Pin
        {
            Label = "MAUI Test Pin",
            Location = pinLocation
        });
    }
    async void OnMapClicked(object sender, MapClickedEventArgs e)
    {
        await DisplayAlert("Map", $"Area {e.Location.Latitude}, {e.Location.Longitude} clicked.", "Ok");
    }
}
MainPage.Xaml
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="MauiMapTest.MainPage"
             Title="MapPage">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Map x:Name="map"
             IsShowingUser="True"
             MapClicked="OnMapClicked"
             Grid.Row="0"
             Grid.ColumnSpan="2" />
    </Grid>
</ContentPage>

Link to public reproduction project repository

https://github.com/bivant/MAUI_MapTest/tree/mapPinClickedFallthrough

Version with bug

7.0 (current)

Last version that worked well

Unknown/Other

Affected platforms

iOS

Affected platform versions

iOS 16.1 (simulator)

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions