Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

132
Vistas
Is it possible to call event.stopPropagation after click in mapbox Geocoder?

Hi I am looking a way to stopPropagation on click event after I click on my geocoder component inside mapbox. I try it this way but it is not working. Only one event type which I found works is .on('result' () => {...} ). Is there other way to achieve this ?? Thx.

  const geocoder = new MapboxGeocoder({
    accessToken: mapboxgl.accessToken,
    mapboxgl: mapboxgl,
    language: 'cs'
  });

  geocoder.on('click', (e: any) => {
    console.log('click'); // This never happen
    e.originalEvent.stopPropagation();
  });

  map.addControl(
    geocoder
  );

Edit: Okay so map.addControl add new controls above map. It looks like this enter image description here

There is problem with that becouse I created button on the right side which change colors and do some stuff when you click on it OR you click direct on map. But if you click on searchbar, this event fire also and action which should be fired only when you click direct on map or that button is called.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

From https://github.com/mapbox/mapbox-gl-geocoder/blob/main/API.md#on, the events that the MapboxGeocoder listens for are clear, loading, results, result, error.

Can you say a little more about why you want to stop the on click event / what you are trying to achieve? That answer might suggestion options for implementation

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda