Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding MapboxDraw breaks 'click' event on mobile #1301

Open
jakovpucekovic opened this issue Oct 9, 2024 · 0 comments
Open

Adding MapboxDraw breaks 'click' event on mobile #1301

jakovpucekovic opened this issue Oct 9, 2024 · 0 comments

Comments

@jakovpucekovic
Copy link

mapbox-gl-js version: 1.13.0
mapbox-gl-draw version: 1.4.3

Steps to Trigger Behavior

  1. Open in mobile browser (or in web browser and change user agent to mobile using developer tools)
  2. Click on map

Expected Behavior

Click event should register.

Actual Behavior

Click event doesn't register. When double clicking, then a single 'click' event registers.

<DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
    <link href="https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.css" rel="stylesheet">
    <script src="https://api.mapbox.com/mapbox-gl-js/v1.13.0/mapbox-gl.js"></script>
    <script src='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.4.3/mapbox-gl-draw.js'></script>
    <link rel='stylesheet' href='https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-draw/v1.4.3/mapbox-gl-draw.css' type='text/css' />
</head>

<style>
    body { margin: 0; padding: 0; }
    #map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>

<body>
    <div id="map"></div>
</body>

<script>

    const map = new mapboxgl.Map({
        container: 'map',
        style: 'enter-your-style'
    });
    map.addControl(new MapboxDraw(), 'top-left');
    map.on('click', () => {
        alert('click');
        console.log('click');
    });
</script>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@jakovpucekovic and others